ERR_REQUIRE_ESM when trying to use persisted in any page
Keagel opened this issue Β· comments
Hi!
I'm surprised I haven't seen this mentioned at all in the issues so maybe this is an issue with my setup, but I get this error whenever I try to use persisted
in any page.
Error [ERR_REQUIRE_ESM]: require() of ES Module node_modules/svelte/src/runtime/store/index.js from node_modules/svelte-persisted-store/dist/index.js not supported.
Instead change the require of node_modules/svelte/src/runtime/store/index.js in node_modules/svelte-persisted-store/dist/index.js to a dynamic import() which is available in all CommonJS modules.
at Object.<anonymous> (node_modules/svelte-persisted-store/dist/index.js:27:2
I'm using the latest version (0.9.2).
Could it be because you don't have type: "module"
in your package.json
? The distributed version I get indicates it's using CommonJS require
syntax:
module.exports = __toCommonJS(svelte_persisted_store_exports);
var import_store = require("svelte/store"); // offending line
var stores = {
local: {},
session: {}
};
Thanks for reporting!
Not sure how that was missed π
It should now be fixed.
π This issue has been resolved in version 0.9.3 π
The release is available on:
Your semantic-release bot π¦π