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

Warning during svelte kit build #23

Closed
nosovk opened this issue Dec 15, 2021 · 8 comments
Closed

Warning during svelte kit build #23

nosovk opened this issue Dec 15, 2021 · 8 comments

Comments

@nosovk
Copy link

nosovk commented Dec 15, 2021

If you will try to use component in svelte kit you will get message:

svelte-paginate is incorrectly packaged. Please contact the package author to fix.

image

Probably it should be migrated to new packaging system presented in kit - https://kit.svelte.dev/docs#packaging

@zhuganglie
Copy link

zhuganglie commented Apr 10, 2022

Same problem here.

svelte-paginate doesn't appear to be written in CJS, but also doesn't appear to be a valid ES module (i.e. it doesn't have "type": "module" or an .mjs extension for the entry point). Please contact the package author to fix.

@w3rafu
Copy link

w3rafu commented Apr 21, 2022

True, still works.

@cassianodaniel
Copy link

svelte-paginate doesn't appear to be written in CJS, but also doesn't appear to be a valid ES module (i.e. it doesn't have "type": "module" or an .mjs extension for the entry point). Please contact the package author to fix.

@bas-baskara
Copy link

Same problem here.

svelte-paginate doesn't appear to be written in CJS, but also doesn't appear to be a valid ES module (i.e. it doesn't have "type": "module" or an .mjs extension for the entry point). Please contact the package author to fix.

I solved this simply by adding "type":"module" in package.json of svelte-paginate in node_modules. I have made PR for this at #27

@cassianodaniel
Copy link

Make sense, @bas-baskara. It is just important to share that by doing this, we're globally changing the default behavior from ESModules to CommonJS.

@jarmitage
Copy link

jarmitage commented Jul 21, 2022

@bas-baskara adding "type":"module" was helpful, thanks

I also had to add "svelte": "src/index.js" as well to address this error:

Unknown file extension ".svelte" for /repo/node_modules/svelte-paginate/src/PaginationNav.svelte
TypeError [ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension ".svelte" for /repo/node_modules/svelte-paginate/src/PaginationNav.svelte
    at new NodeError (node:internal/errors:372:5)
    at Object.getFileProtocolModuleFormat [as file:] (node:internal/modules/esm/get_format:76:11)
    at defaultGetFormat (node:internal/modules/esm/get_format:118:38)
    at defaultLoad (node:internal/modules/esm/load:21:20)
    at ESMLoader.load (node:internal/modules/esm/loader:407:26)
    at ESMLoader.moduleProvider (node:internal/modules/esm/loader:326:22)
    at new ModuleJob (node:internal/modules/esm/module_job:66:26)
    at ESMLoader.#createModuleJob (node:internal/modules/esm/loader:345:17)
    at ESMLoader.getModuleJob (node:internal/modules/esm/loader:304:34)
    at async ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:82:21)

Based on this discussion JustinVoitel/svelte-hero-icons#18

If others also have this issue, maybe it can be added to your PR @bas-baskara.

jarmitage added a commit to jarmitage/svelte-paginate that referenced this issue Jul 21, 2022
@bas-baskara
Copy link

@jarmitage Yes thank you, I added your suggestion and also typescript support into my PR because I need it in my project too.

@TahaSh
Copy link
Owner

TahaSh commented Oct 31, 2022

Fixed in v0.1.0.

@TahaSh TahaSh closed this as completed Oct 31, 2022
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

7 participants