-
Notifications
You must be signed in to change notification settings - Fork 30k
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
--es-module-specifier-resolution=node not working from v13.0.1 #30520
Comments
The fix for this would be to ensure that This is because the CJS loader is doing the main entry resolution, and does not include A way to get it to work would be to write: extensions.js require._extensions['.mjs'] = require._extensions['.js']; which would allow:
A PR to add this when the flag is set is welcome. |
@guybedford Thanks for the explanation. I tried to create a PR to fix this issue: #30574. Please correct me if I understand it wrong. |
Has this flag been renamed to |
@dandv we have renamed the flag, but we continue to support |
@guybedford when I create
I get:
what am I missing? |
@MylesBorins I'm in Node 14.8 and trying to use
however using |
@trusktr |
Oops, I copy-pasted from above. xD |
Ironically fixing the typo wasn't all. It requires a value: |
getting this error |
@Santosh-13 That flag is working on Node 12 and up. |
node v16.13.1, Windows 10 getting this error
with script
Now it is the expected behaviour? |
@viT-1 I've been getting the same issue for days. I'm also using node v16.13.1 Imports of ES^ module in my app are not resolved - This thread says that you have to add the '.js' extension to solve the problem but that didn't work for me. That's my ts.config.server.json
ts-node command
fails with
|
@jaybe78 For ts-project I solved aliases 2 years ago. |
--es-module-specifier-resolution=node
is documented for v13.x:Here is the specific example that works in v13.0.0, but not in v13.0.1 or v13.1.0:
As you can see in the screenshot above, the error is:
The text was updated successfully, but these errors were encountered: