question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

package.json "exports" field fallback array support

See original GitHub issue

Clear 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

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:1
  • Comments:8 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
Niputicommented, Jul 30, 2021

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 library

0reactions
aleclarsoncommented, Oct 17, 2022

See #10504

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found