-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Error [ERR_REQUIRE_ESM]: Must use import to load ES Module #1975
Comments
I am having related problems, also with In your case, perhaps you need to explicity specify I might try to see if I can reproduce your issue. I was previously using In my case (at the moment, I've been through some other permutations), I have // node_modules/ws/wrapper.mjs
var import_stream = __toESM(require_stream(), 1); I know that this is a different issue really, but seeing that it appears somewhat related I thought it might not do any harm to dump some of my experience here. I wasn't quite at the point that I was sure whether it was appropriate to file as an issue or not. |
p.s. you could also try making ws |
Setting |
Agreed. I'm also not sure why In my case I am running node v16.6.0 in Windows 10, FWIW. Also |
this only seems to occur when I supply |
I am having the same problem. When I use the cli options So (in my project) Ideally in this case, I would like the transformed code to use the original bare module name - i.e. just I can get around the problem by also specifying the particular problem package, i.e. But I think it would be nicer if I didn't have to do that, and the module resolution was left to node for all external packages. |
This is the same issue as #1958 I think |
Hello, this is my code:
And this is the built(bundled) file:
However when I run
node ./dist/index.js
, it throws this error:I checked
ws
'spackage.json
and I guess the problem is for this:According to docs, setting
platform:node
will setformat
tocjs
so it should usews
'sindex.js
notwrapper.mjs
. I don't know what's the problem. I also setformat: esm
and again run bundled file but it throwsThe text was updated successfully, but these errors were encountered: