robinrodricks / vue3-touch-events

Simple touch events support for vue.js 3
MIT License
216 stars 27 forks source link

Update package.json type #17

Closed 6r1d closed 1 year ago

6r1d commented 1 year ago

Hello. Thanks for the nice library!

Without {"type": "module"}, I see this error in VitePress:

(node:16307) Warning: To load an ES module, set "type": "module" in the package.json or use the .mjs extension.
(Use `node --trace-warnings ...` to show where the warning was created)
build error:
 /home/user/project/node_modules/vue3-touch-events/index.js:416
export default vueTouchEvents
^^^^^^

SyntaxError: Unexpected token 'export'
    at Object.compileFunction (node:vm:360:18)
    at wrapSafe (node:internal/modules/cjs/loader:1048:15)
    at Module._compile (node:internal/modules/cjs/loader:1083:27)
    at Module._extensions..js (node:internal/modules/cjs/loader:1173:10)
    at Module.load (node:internal/modules/cjs/loader:997:32)
    at Module._load (node:internal/modules/cjs/loader:838:12)
    at ModuleWrap.<anonymous> (node:internal/modules/esm/translators:170:29)
    at ModuleJob.run (node:internal/modules/esm/module_job:193:25)
    at async Promise.all (index 0)
    at async ESMLoader.import (node:internal/modules/esm/loader:527:24)
 ELIFECYCLE  Command failed with exit code 1.

With {"type": "module"}, the component using vue3-touch-events works normally.

UPD: it got more confusing and I had to replace the import as well: import vueTouchEvents from "vue3-touch-events";

~Hopefully, it is OK to merge.~ Let's discuss how to integrate ESM, if possible.

robinrodricks commented 1 year ago

Thanks

paulocheque commented 1 year ago

Version 4.1.0 continue with this error, at least in this CDN: https://www.jsdelivr.com/package/npm/vue3-touch-events

Fiddle: https://jsfiddle.net/api/post/library/pure

Any plans to release the 4.1.1?