package.json "exports" field fallback array support
See original GitHub issueClear and concise description of the problem
Currently vite does not support fallback array in “exports” field in package.json, vite does support array type but when first entrypoint is not accessable, an error will show. webpack 5 has already has a implementation in Alternatives.
Suggested solution
add fallback array support
Alternative
No response
Additional context
"exports": {
"default": {
"import": [
"./dist/index.esm.js",
"./src/index.tsx"
],
"require": "./dist/index.umd.js"
}
},
Validations
- Follow our Code of Conduct
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn’t already an issue that request the same feature to avoid creating a duplicate.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:8 (7 by maintainers)
Top Results From Across the Web
Modules: Packages | Node.js v19.3.0 Documentation
Existing packages introducing the "exports" field will prevent consumers of the package from using any entry points that are not defined, including the...
Read more >Package exports - webpack
The exports field in the package.json of a package allows to declare which module should be used when using module requests like import...
Read more >Node.JS (New) Package.json Exports Field | by Thomas Juster
The documentation for the exports package.json field is here, it comes from this proposal. I won't cover everything, so check out the ...
Read more >New package.json `exports` field not working with TypeScript
It is an upcoming feature of Typescript 4.5 which soon should be available: // package.json { "name": "my-package", "type": "module", ...
Read more >Documentation - ECMAScript Modules in Node.js - TypeScript
js here. package.json Exports, Imports, and Self-Referencing. Node.js supports a new field for defining entry ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I think this should be made at the library. I remember reading a conversation on twitter Evan had that there should be a library for making a standard way of reading the exports and
resolve.exports
got made for this purpose. with a github search, it can be seen at wmr, marko, dvlp and vite uses this librarySee #10504