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

Not working with SvelteKit due to lack of ESM export #1

Closed
benwoodward opened this issue May 24, 2021 · 1 comment
Closed

Not working with SvelteKit due to lack of ESM export #1

benwoodward opened this issue May 24, 2021 · 1 comment

Comments

@benwoodward
Copy link

Hi, just FYI, this is package is failing with SvelteKit due to the lack of ESM export:

/Users/ben/dev/my-project/node_modules/svelte-gh-hotkey/index.js:1
import {
^^^^^^

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)

It may be required to explicitly specify export paths in package.json due to this issue: sveltejs/kit#1498

@selevt
Copy link
Owner

selevt commented Jun 3, 2021

Hi @benwoodward, thanks for reporting.
Just tried by adding it to a new svelte-kit app, but couldn't reproduce, neither in dev nor prod build. But I've pushed a new version that adds "type": "module" to package.json, which should help to avoid it being loaded with commonjs.

@selevt selevt closed this as completed Jun 3, 2021
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

2 participants