-
-
Notifications
You must be signed in to change notification settings - Fork 163
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
[Bug] Explicit ESM declaration #53
Labels
bug
Something isn't working
Comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This module is being used by Drauu which has an integration with VueUse and can be used with Nuxt (Vue). Since Nuxt 3 uses Vite as a bundler by default and it only allows the use of ESM modules, when it tries to bundle
perfect-freehand
the following error occurs:import { getStroke } from "perfect-freehand";
^^^^^^^^^
SyntaxError: Named export 'getStroke' not found. The requested module 'perfect-freehand' is a CommonJS module, which may not support all module.exports as named exports.
CommonJS modules can always be imported via the default export, for example using:
import pkg from 'perfect-freehand';
const { getStroke } = pkg;
I was able to "fix" it by adding the following lines into the
package.json
insidenode_modules
:"type": "module",
"exports": {
".": {
"types": "./dist/types/index.d.ts",
"import": "./dist/esm/index.js"
}
}
I'm not sure if this may cause some problems that's why I'm opening an Issue
The text was updated successfully, but these errors were encountered: