-
-
Notifications
You must be signed in to change notification settings - Fork 34.2k
Closed
Labels
moduleIssues and PRs related to the module subsystem.Issues and PRs related to the module subsystem.
Description
Is your feature request related to a problem? Please describe.
Yes. I would like to be able to statically resolve entry points to path/*/index.js and path/*.js, similar to how is done in CJS, e.g. by adding a trailing slash to the match pattern like so:
"exports": {
"./package.json": "./package.json",
".": "./dist/index.js",
"./*/": "./dist/*/index.js",
"./*": "./dist/*.js"
},This would allow interop with traditional indexing:
import 'my-package/path/to/dir/'
// resolves to `my-package/path/to/dir/index.js`
import 'my-package/path/to/dir/module'`
// resolves to `my-package/path/to/dir/module.js`This is currently not feasible as I understand it, and it would be necessary to import via import '.../index.js' regardless of how the exports field is configured.
Describe the solution you'd like
Modify exports field logic to differentiate between ./* and ./*/.
Allow a single pattern to have multiple matches, either via:
"exports": {
"./package.json": "./package.json",
".": "./dist/index.js",
"./*": "./dist/*/index.js",
"./*": "./dist/*.js"
},Or:
"exports": {
"./package.json": "./package.json",
".": "./dist/index.js",
"./*": ["./dist/*/index.js", "./dist/*.js"]
},b3ngg, Eliav2, ShravanKarnati and eric-gitta-moore
Metadata
Metadata
Assignees
Labels
moduleIssues and PRs related to the module subsystem.Issues and PRs related to the module subsystem.