-
Notifications
You must be signed in to change notification settings - Fork 293
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
ESM mode still uses "require" within an ESM module #1163
Comments
I am also running into this issue. Running with sourcemaps also gives |
This sounds like a duplicate of #749 |
It is not, #749 mentions wanting to output CJS within an ESM module, and it can't access __dirname / __filename This is issue is about outputing ESM in an ESM module, and importing other ESM modules. |
Oops, I meant duplicate of #791 |
I think I have the same error. I upgraded a package that required me to update my script to be a module so I could use import. Now I can run the script manually just fine, but once I compile it with ncc and try to run it, it fails
There are no require's in my codebase anymore and it looks like the generated |
Hi,
I'm trying to bundle my dependencies within an ESM package I get mixed results depending if the module I compile is using ESM or CJS.
Here is an example of three packages I'm trying to bundle, each in their separate file;
is-fullwidth-code-point
, CJS moduleslice-ansi
, ESM module, depends onis-fullwidth-code-point
string-width
, CJS module, depends onis-fullwidth-code-point
When compiling these three modules they all compile fine, and create a
package.json
containing{ "type": "module" }
.However, within
string-width
, NCC (I guess because of the asset relocator)require
calls are transformed to the following:Which fails when we try to run it since the result is a
require
of an ESM module:is there a way to tell the asset relocator that the destination is an ESM module and it should let webpack hoist the dependency ?
The text was updated successfully, but these errors were encountered: