Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: "Attempted to load JSON module without specifying 'type': 'json'" when importing JSON in Deno REPL #26041

Closed
nestarz opened this issue Oct 5, 2024 · 1 comment · Fixed by #26053
Labels
bug Something isn't working correctly cli related to cli/ dir

Comments

@nestarz
Copy link

nestarz commented Oct 5, 2024

Deno Version:

2.0.0-rc.10

Environment:

  • REPL is running with all permissions allowed.
  • Attempted to import a JSON file using:
    import a from "./deno.json" with { "type":"json" };

Error Message:

Uncaught TypeError: Attempted to load JSON module without specifying "type": "json" attribute in the import statement.
    at async <anonymous>:1:47

Expected Behavior:

The JSON file should load correctly when specifying "type": "json" in the import statement in Deno REPL.

Actual Behavior:

The error occurs despite specifying the "type": "json" attribute in the import statement.

Steps to Reproduce:

  1. Run Deno REPL with all permissions allowed.
  2. Attempt to import a JSON file using the following statement:
    import a from "./deno.json" with { "type": "json" };
  3. Observe the TypeError.

Additional Information:

  • This issue seems related to JSON module handling in Deno REPL for the specific version (2.0.0-rc.10).
  • JSON import works as expected outside the REPL.
@satyarohith satyarohith added bug Something isn't working correctly cli related to cli/ dir labels Oct 7, 2024
@bartlomieju
Copy link
Member

Ref denoland/deno_ast#279

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working correctly cli related to cli/ dir
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants