-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
--format=cjs behave differently depends on node version #1636
Comments
Dynamic import is available in node13, so it is kept when the target node version is higher than that. To speak the difference of |
thanks for the context. I think it's just surprising to me that esbuild's output varies based on node version. Other tools like TSC exposes option like I haven't looked into every piece of our internal code to see whether it's possible to migrate them to respect |
Native dynamic import expressions are critical to CommonJS/ESM interoperability. TypeScript’s (tsc) current behavior unfortunately breaks this interoperability. |
See #1084 for additional context. |
Thanks, I guess this is a won't fix, closing. |
Not sure if I configured incorrectly, but when we set target to different node version, the transform behavior on
await import
is different. I didn't find a way to configure target to node14 that keep the await import behavior to commonjs.Sample code
Transform output
--target=node12
--target=node14
tsc output (module=commonjs, despite of node version)
Run output
The text was updated successfully, but these errors were encountered: