-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
feat(es/ast): Support import attributes proposal #7868
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
swc-bump:
- swc_ecma_ast --breaking
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Automated review comment generated by auto-rebase script
Hi @kdy1, I use This feature transforms the import data from "./data.json" assert { type: "json" }; import data from "./data.json" with {
type: "json"
}; However, there are a lot of environments (including our node 18/20) only support import assertions and not import attributes. So it causes a SyntaxError: SyntaxError: Unexpected token 'with'
at CustomizedModuleLoader.moduleStrategy (node:internal/modules/esm/translators:116:18)
at CustomizedModuleLoader.moduleProvider (node:internal/modules/esm/loader:190:14)
at async link (node:internal/modules/esm/module_job:67:21) Is it as expected? |
I didn't expect it |
There is a babel plugin supporting transform from However, in my case, avoiding transform from |
The status currently is that:
Our goal is to only have babeljs.io/docs/babel-plugin-proposal-import-attributes-to-assertions as a temporary plugin, and deprecate it as soon as it's feasible to do so. |
Description:
Related issue:
import '...' with {...}
#7179