Open greybaron opened 6 months ago
I can confirm the issue.
Although the #661 does fix this setup, it also breaks the test suite, as jest (the test framework) doesn't support es modules.
The workaround, for now, is to use the import *
syntax:
import * as CookieConsent from 'vanilla-cookieconsent';
I can confirm the issue.
Although the #661 does fix this setup, it also breaks the test suite, as jest (the test framework) doesn't support es modules.
The workaround, for now, is to use the
import *
syntax:import * as CookieConsent from 'vanilla-cookieconsent';
OK but could the Sveltekit example be updated to reflect this? Now the SvelteKit users have to figure this out by themselves.
@rbozan sure, updated!
Expected Behavior
Importing the module works as it does in StackBlitz SvelteKit example
Current Behavior
After importing the dependency, multiple errors are thrown about cookieconsent being a CommonJS module:
the workarounds provided by the error messages are ineffective.
Steps to reproduce
Generate a new SvelteKit 2.x project, using Node 20.x Recreate the StackBlitz example
Proposed fix or additional info.
Since this is an ES module, the following property should be set inside
package.json:
"type": "module",
Without this property, Node considers this to be a CommonJS module and throws multiple errors.Note: I assume this behaviour was introduced between Node 18.18 and 20.x, as it works on Node 18 on StackBlitz
Version
3.0.0
On which browser do you see the issue?
Other