-
-
Notifications
You must be signed in to change notification settings - Fork 531
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
[esm] Cannot import from external packages with an exports
field that contains a wildcard and an extension
#1934
Comments
I just ran in to this, as well. |
turns out! I only had to change |
Hitting this too and I have moduleResolution set to NodeNext. Removing the extension worked though. So the exports field is now |
The current implementation of the import resolution is from Node v15.3, and it basically assumes Since the file is a verbatim copy of Node's version I assume this matched the behaviour of Node at v15.3, but v16.9 updated it and all currently supported up to date Node versions now follow a different resolution logic. As an example in some of my packages I like to enable folder paths to be resolved to {
"exports": {
".": "./build/index.js",
"./*.js": "./build/*.js",
"./*": "./build/*/index.js",
"./*/": "./build/*/index.js"
},
} I'd expect This |
I've found the missing puzzle piece: nodejs/node#39635
|
face this issue too. |
Search Terms
esm, external, exports, wildcard, extension
Expected Behavior
If a package defines an
exports
fieldAnd a consuming package imports:
The program should compile and execute with
ts-node-esm
.Actual Behavior
An
ERR_PACKAGE_PATH_NOT_EXPORTED
exception is raised.Steps to reproduce the problem
I have made a branch on a repo to reproduce this issue.
Minimal reproduction
If the compiled form of the program is run with Node, no error occurs:
Specifications
The text was updated successfully, but these errors were encountered: