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

False reporting of non default import from JSON module #3070

Closed
penx opened this issue Apr 18, 2023 · 0 comments
Closed

False reporting of non default import from JSON module #3070

penx opened this issue Apr 18, 2023 · 0 comments

Comments

@penx
Copy link

penx commented Apr 18, 2023

Given

export { default as a } from "./a.json" assert { type: "json" };

returns the error

 [ERROR] Cannot use non-default import "a" with a standard JSON module

    main.js:1:20:
      1 │ export { default as a } from "./a.json" assert { type: "json" };
        ╵                     ^

  This is considered an import of a standard JSON module because of the import assertion here:

    main.js:1:49:
      1 │ export { default as a } from "./a.json" assert { type: "json" };
        ╵                                                  ~~~~~~~~~~~~

  You can either keep the import assertion and only use the "default" import, or you can remove the import assertion and use the "a" import (which is non-standard behavior).

However, this is not using a non default import.

https://hyrious.me/esbuild-repl/?version=0.17.17&mode=build&modules=%5B%5B%22main.js%22%2C%22export+%7B+default+as+a+%7D+from+%5C%22.%2Fa.json%5C%22+assert+%7B+type%3A+%5C%22json%5C%22+%7D%3B%22%2C1%5D%5D&buildOptions=%7B%22bundle%22%3Atrue%2C%22format%22%3A%22esm%22%2C%22splitting%22%3Atrue%7D

@evanw evanw closed this as completed in 1365a07 Apr 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant