Inconsistency with TypeScript in Module Resolution with Fully-Specified ESM Imports
- Dominant language
- JavaScript
- Stars
- 4.8k
- Forks
- 456
- Avg merge
- 9h 19m
- Merged PRs (30d)
- 2
Description
**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 and `tsx`, as per the TypeScript team here: https://github.com/microsoft/TypeScript/issues/41887#issuecomment-741968855 )
See more details at the issue in the webpack repo: https://github.com/webpack/webpack/issues/13252
**Expected/desired behavior:**
`babel-loader` resolves modules the same as TypeScript and `tsx` do.
* **If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem along with a gist/jsbin of your webpack configuration.**
https://github.com/Josehower/webpack-babel-test
* **What is the expected behavior?**
`babel-loader` resolves modules the same as TypeScript and `tsx` do.
* **What is the motivation / use case for changing the behavior?**
It's unexpected that what works in TypeScript + `tsx` does not work with webpack and `babel-loader`
Contributor guide
Research direction
Start with the linked webpack issue and the Josehower/webpack-babel-test reproduction, then trace how fully specified .js imports are resolved by babel-loader. Compare the behavior with TypeScript and tsx for matching .ts and .tsx files. Done means babel-loader resolves these imports consistently with TypeScript and tsx.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- babel, javascript, typescript, webpack
- Domain
- build-system, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100