Closed NathanNobert closed 1 year ago
@NathanNobert,
(edit) if you use vite in your svelte project
Try adding
optimizeDeps: {
exclude: ['@beyonk/gdpr-cookie-consent-banner']
}
in your vite.config.js
or vite.config.ts
file
It seems that it's sometimes still not obvious how to consume svelte component which are external dependencies. Vite, seeing that the dep is in the node_modules
directory tries to handle the import as a "non-svelte-potentially-cjs module".
Small note for Sveltekit users:
the vite trick above seems not necessary anymore with the ^10.0.0 version of this package!
I receive an error when trying to use this in a project when running locally using Svelte. The error is:
I believe this is due to my Svelte project using Modules and typescript, as in my package.json file I have:
I do not receive this error when building and deploying to production however.