You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
TypeScript is configured to allowJS, which we need in a project we are transitioning over to TS gradually. We also have baseUrl/paths configured to be able to do absolute imports of modules in src.
The ncc build runs fine and absolute imports of TS files work perfectly, but when running the output we get a Cannot find module for a JS file we tried to import using an absolute import.
In summary:
relative TS import: ✔
absolute TS import: ✔
relative JS import: ✔
absolute JS import: ❌
I would expect this to either work or hope to get at least an error during build. We can work around this using relative imports for the JS files, but it's easy to accidentally forget and then get a runtime error once the app is built and deployed 😬
The text was updated successfully, but these errors were encountered:
I've created a repo to reproduce this issue:
https://github.com/novascreen/ncc-ts-allowjs
TypeScript is configured to
allowJS
, which we need in a project we are transitioning over to TS gradually. We also havebaseUrl
/paths
configured to be able to do absolute imports of modules insrc
.The ncc build runs fine and absolute imports of TS files work perfectly, but when running the output we get a
Cannot find module
for a JS file we tried to import using an absolute import.In summary:
I would expect this to either work or hope to get at least an error during build. We can work around this using relative imports for the JS files, but it's easy to accidentally forget and then get a runtime error once the app is built and deployed 😬
The text was updated successfully, but these errors were encountered: