ccampbell / mousetrap

Simple library for handling keyboard shortcuts in Javascript
https://craig.is/killing/mice
Apache License 2.0
11.69k stars 968 forks source link

Needs ESM export #504

Open benwoodward opened 3 years ago

benwoodward commented 3 years ago

Trying to use this with https://github.com/wareset/svelte-use-mousetrap + https://github.com/sveltejs/kit and not able to get it work due to the lack of ESM export in the package.

> Cannot use import statement outside a module
/Users/ben/dev/my-project/node_modules/svelte-use-mousetrap/index.js:1
import Mousetrap from 'mousetrap';
^^^^^^

SyntaxError: Cannot use import statement outside a module
    at wrapSafe (internal/modules/cjs/loader.js:979:16)
    at Module._compile (internal/modules/cjs/loader.js:1027:27)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
    at Module.load (internal/modules/cjs/loader.js:928:32)
    at Function.Module._load (internal/modules/cjs/loader.js:769:14)
    at ModuleWrap.<anonymous> (internal/modules/esm/translators.js:199:29)
    at ModuleJob.run (internal/modules/esm/module_job.js:152:23)
    at async Loader.import (internal/modules/esm/loader.js:166:24)
    at async prerender (file:///Users/ben/dev/my-project/node_modules/@sveltejs/kit/dist/chunks/index5.js:79:14)
    at async Object.prerender (file:///Users/ben/dev/my-project/node_modules/@sveltejs/kit/dist/chunks/index5.js:296:5)