-
Notifications
You must be signed in to change notification settings - Fork 12k
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
Allow imports with .js extension #4591
Comments
Do we agree the original file is It's not about including .js files, it's about loading .ts files (as Angular is in TypeScript) but accordingly to the ES modules loading spec. |
I see what you're saying now, I am looking through this now. |
Unfortunately, I'm going to close this as Working As Intended right now. The ESM spec is not finalized yet, and webpack does not support it. We found no problem in the CLI code, but we end up passing We will continue investigate this as ESM is finalized and webpack support is added. We may release a minor update to support it at that time. Cheers. |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Versions.
@ngtools/webpack
1.2.9Repro steps.
Since TS 2.0, it's possible to :
import { Something } from './something.js'
;But using this possibility with
@ngtools/webpack
results in error :Module not found: Error: Can't resolve './something.js'
It's important to be compatible with ES6 modules, which require the
.js
extension, as<script type="module"></script>
is now in test in all browsers, and as for now TS doesn't provide an option to add the.js
extension in transpiled files (see microsoft/TypeScript#13422).It's possible when using
ngc
directly, and also in rollup/rollup-plugin-typescript so I assume it's possible with@ngtools/webpack
too.The text was updated successfully, but these errors were encountered: