-
-
Notifications
You must be signed in to change notification settings - Fork 451
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
Inconsistency with TypeScript in Module Resolution with Fully-Specified ESM Imports #904
Comments
You could use a Babel plugin to rewrite import paths (for example, https://www.npmjs.com/package/babel-plugin-module-rewrite), but it really should be done by configuring webpack to use the resolution strategy you want. |
Yeah, that was my first impression as well - first of all, we started the investigation on the webpack end. But in the end, users will configure As Alexander says below, webpack is currently working correctly, so this becomes a concern of the loaders, such as
webpack/webpack#13252 (comment) More details from Alexander:
|
Ah Sokra has now said it will probably be in core:
webpack/webpack#13252 (comment) So I guess once this resolver plugin exists, if it won't be enabled automatically (which would be ideal), loaders who consume TS should verify that this resolver plugin is enabled. |
I'm submitting a bug report
Webpack Version:
5.36.0
Babel Core Version:
7.13.16
Babel Loader Version:
8.2.2
Please tell us about your environment:
Windows 10
Current behavior:
Fully-specified ES Module Imports (with the
.js
extension) do not resolve to the correct, matching.ts
or.tsx
files (as is the behavior of TypeScript andtsx
, as per the TypeScript team here: microsoft/TypeScript#41887 (comment) )See more details at the issue in the webpack repo: webpack/webpack#13252
Expected/desired behavior:
babel-loader
resolves modules the same as TypeScript andtsx
do.https://github.com/Josehower/webpack-babel-test
babel-loader
resolves modules the same as TypeScript andtsx
do.It's unexpected that what works in TypeScript +
tsx
does not work with webpack andbabel-loader
The text was updated successfully, but these errors were encountered: