Description
Bug Report
Auto import not working as expected for modules that use the exports
field and type: module
in package.json.
Relevant PR that introduced exports
support: #44501
🕗 Version & Regression Information
Occurs in 4.5.0-dev.20211012
and 4.5.0-beta
.
⏯ Playground Link
It's a bit hard to reproduce in the playground, so I've created a repository here https://github.com/renke/typescript-4.5-beta-exports – The README contains some instructions on how to reproduce it. It also describes another bug that was already filed here #46333 so it can probably be ignored.
🙁 Actual behavior
Auto import doesn't work for non-root exported modules (unless they are already imported elsewhere).
Also, ./*
exports can not be imported at all.
Running the modules via node
works, so the exports
configuration should be valid.
🙂 Expected behavior
Auto import should work for all modules explicitly exported via exports
when the exporting package is listed in dependencies
(as in #38923).
Also, import (and auto import) should work for ./*
exports. Unclear if this would lead to performance problems for auto import, but I think this should be supported.