-
Notifications
You must be signed in to change notification settings - Fork 12.5k
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
rewriteRelativeImportExtensions does not rewrite the extension for an import expressions unless the file is detected to be a module #60599
Comments
I don't think this has to do with the import being twice, but rather module detection? This one rewrites paths too: https://www.typescriptlang.org/play/?rewriteRelativeImportExtensions=true#code/JYWwDg9gTgLgBAcgHQHoBmEICYkwM4IDcAsAFCiSwAUy6muBAlGUA |
Looks like you might be right. export {};
import('./foo.js') This also correctly transforms the extension. |
FWIW I'm not sure that this is incorrect behavior; this transformation was only intended on applying in modules, so if we don't think a file is a module, then it won't happen. What condition are you running under where the file is not a module? (Maybe we should rewrite imports in |
If you're working in LTS node then the only way to access ESM in CJS is via |
To be clear a "module" to us means "not a global script"; CJS are modules in this scheme. |
π Search Terms
rewriteRelativeImportExtensions, import expression
π Version & Regression Information
β― Playground Link
https://www.typescriptlang.org/play/?rewriteRelativeImportExtensions=true#code/PTAEEsFsAcHsCcAuoDkA6YAzWs2IM4oDcAsAFBRxIAU6WOehAlOUA
π» Code
Test One
Test Two
π Actual behavior
JS Output
Test One
Test Two
π Expected behavior
JS Output
Test One
Test Two
Additional information about the issue
No response
The text was updated successfully, but these errors were encountered: