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
Regression of import
statement when targeting CJS
#2019
Comments
Since 0.14.5, esbuild's interop between cjs → esm has been changed to be the same as other front-end bundlers when not using .mjs/.mts/.cts extensions. i.e. This is the convension in front-end. If you bring that to node, something like this (the uuid package defined __esModule, and its default prop is undefined, which means he doesn't want you to import its default name) will break. In short, you can change the filename extension to .mjs/.mts/.cts to bring back old behavior like 0.13.x. Or edit your code to @evanw why don't we make node behavior as default when |
The description above is accurate. Version 0.14.5 deliberately changed esbuild's handling of
The rationale is that since Webpack is used much more than esbuild, packages in the wild already have to be tuned for Webpack's behavior so matching Webpack's behavior in this case is a reasonable decision. The easiest way to get this to work is to avoid a -import uuid from "uuid";
+import * as uuid from "uuid"; Closing as by design.
That would make the rules around |
When importing the uuid package, this should be marked with __toModule, instead it's marked with __reExport.
This is a regression and breaks codebases that previously worked.
https://github.com/jacob-ebey/esbuild-import-regression
The text was updated successfully, but these errors were encountered: