Skip to content
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

Add "type"="module" to package.json or export .mjs file #724

Open
robinscholz opened this issue Feb 10, 2025 · 0 comments
Open

Add "type"="module" to package.json or export .mjs file #724

robinscholz opened this issue Feb 10, 2025 · 0 comments

Comments

@robinscholz
Copy link

Hi xiel,

woudl you consider adding "type"="module" to the package.json, seeing as ESM is pretty much the way forward for the JS ecosystem? I finally moved the dependency back to this package from our fork and ran into some issues with Vite and SSR today.

From the Node docs:

Node.js will treat the following as ES modules when passed to node as the initial input, or when referenced by import statements or import() expressions:

  • Files with an .mjs extension.
  • Files with a .js extension when the nearest parent package.json file contains a top-level "type" field with a value of "module".

The esm export of wheel-gestures uses .esm.js as its extension, which does not get picked up by node and results in vite thinking its a common js module when trying to build the server bundle.

You could either change the filename of the esm build to wheel-gestures.mjs or add "type"="module" to the package.json.

Thanks again for making the suggested changes with the exports field!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant