Skip to content

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

@robinscholz

Description

@robinscholz

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions