Skip to content

Advice for build using ES6 modules #90

Answered by ElMassimo
lutuh asked this question in Q&A
Discussion options

You must be logged in to vote

Hi Lucas! @lutuh

Vite relies on modern practices to detect whether a package is CJS or ESM, or both, and performs certain optimizations (like pre-bundling during dev, or external during SSR), to ensure it's loaded in the more efficient way.

Package Problem

It seems that this package has not been updated to use [recent practices to be compatible with CJS and ESM at the same time.

For example, it does not supply the exports field (nor the module field as a fallback), and it does not have "type": "module".

In addition, the main entry it supplies, does not exist.

Solution

Fork (or make a PR) to add the exports field to the package.json:

  "type": "module",
  "exports": {
    ".": "./dist/phot…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by ElMassimo
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants