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
The TypeScript compiler does not add .js to import paths when it transpiles files, which in my opinion is a bug but is declared as by-design from the TypeScript team. This can be an issue depending on how exactly the package is consumed (outside TypeScript, which bundler etc.). See also https://stackoverflow.com/q/62619058.
The proposed solution in the linked issue above is to add .js to imports in source code. TypeScript apparently knows to look for the .ts file if it sees .js...
Note that this is specifically for libraries and not for applications. The latter are processed with a bundler, in our case rollup (see forum sample), which does add the .js extensions automatically when generating output files. But using a bundler for things that shouldn't be bundled or tree-shaken doesn't make much sense and would only complicate things.
It's all a bit sad but I think I'll just go ahead and add the extensions together with a new DEVELOPMENT.md under js/ccf-app explaining it.
The text was updated successfully, but these errors were encountered:
The TypeScript compiler does not add
.js
to import paths when it transpiles files, which in my opinion is a bug but is declared as by-design from the TypeScript team. This can be an issue depending on how exactly the package is consumed (outside TypeScript, which bundler etc.). See also https://stackoverflow.com/q/62619058.The proposed solution in the linked issue above is to add
.js
to imports in source code. TypeScript apparently knows to look for the.ts
file if it sees.js
...I found this which at least is one more reference:
https://blog.logrocket.com/publishing-node-modules-typescript-es-modules/
Note that this is specifically for libraries and not for applications. The latter are processed with a bundler, in our case rollup (see forum sample), which does add the
.js
extensions automatically when generating output files. But using a bundler for things that shouldn't be bundled or tree-shaken doesn't make much sense and would only complicate things.It's all a bit sad but I think I'll just go ahead and add the extensions together with a new
DEVELOPMENT.md
underjs/ccf-app
explaining it.The text was updated successfully, but these errors were encountered: