Closed kuechlerm closed 2 years ago
Can you create a reproduction in a codesandbox or equivalent? I'll need more information on what kind of environment this occurs to address. Thanks!
You could clone this : https://github.com/kuechlerm/svelte-stores-bug Its a minimal Sveltekit setup. My system versions are in README.md.
I get
exports is not defined in ES module scope
This file is being treated as an ES module because it has a '.js' file extension and 'C:\Dev\svelte-stores-bug\node_modules\@square\svelte-store\package.json' contains "type": "module".
To treat it as a CommonJS script, rename it to use the '.cjs' file extension.
ReferenceError: exports is not defined in ES module scope
This file is being treated as an ES module because it has a '.js' file extension and 'C:\Dev\svelte-stores-bug\node_modules\@square\svelte-store\package.json' contains "type": "module".
To treat it as a CommonJS script, rename it to use the '.cjs' file extension.
at file:///C:/Dev/svelte-stores-bug/node_modules/@square/svelte-store/lib/index.js:60:1
at ModuleJob.run (node:internal/modules/esm/module_job:195:25)
at async Promise.all (index 0)
at async ESMLoader.import (node:internal/modules/esm/loader:337:24)
at async importModuleDynamicallyWrapper (node:internal/vm/module:437:15)
at async nodeImport (C:\Dev\svelte-stores-bug\node_modules\vite\dist\node\chunks\dep-59dc6e00.js:59403:21)
at async eval (/src/routes/index.svelte:7:31)
at async instantiateModule (C:\Dev\svelte-stores-bug\node_modules\vite\dist\node\chunks\dep-59dc6e00.js:59333:9)
the above PR fixes the issue in the project @kuechlerm linked and is confirmed to work in square's projects.
@SarcevicAntonio could you confirm that this PR won't break your project? Thanks
@SarcevicAntonio could you confirm that this PR won't break your project? Thanks
Going to bed now, but I can try to check it out tomorrow when I get a chance 😅
Ha no hurry at all! Enjoy your night
Sadly I get some errors when my SvelteKit app boots up:
index.ts:327 Uncaught (in promise) ReferenceError: exports is not defined
at node_modules/@square/svelte-store/lib/index.js (index.ts:327:14)
at __init (chunk-M5PF3ZFT.js?v=e2583755:25:56)
at dep:@square_svelte-store:1:16
The dep:@square_svelte-store:1:16
file seems to be generated by Vite and contains
export default require("./node_modules/@square/svelte-store/lib/index.js");
.
I can't seem to figure out why this happens.
Sadly I get some errors when my SvelteKit app boots up:
index.ts:327 Uncaught (in promise) ReferenceError: exports is not defined at node_modules/@square/svelte-store/lib/index.js (index.ts:327:14) at __init (chunk-M5PF3ZFT.js?v=e2583755:25:56) at dep:@square_svelte-store:1:16
The
dep:@square_svelte-store:1:16
file seems to be generated by Vite and containsexport default require("./node_modules/@square/svelte-store/lib/index.js");
.I can't seem to figure out why this happens.
Dang. Would you be able to to create a minimal repro repo like kuechlerm did?
I can try, but it might take me till monday.
Totally, this is non urgent
Repro didn't produce any errors. Works as expeceted.
I then tried to get my project to break again, but it now works fine. 😅
It might have been, that some .svelte-kit/
or vite stuff was still stale... Sorry for the confusion.
Okay great to know, thanks for confirming :)
When using the current version 0.1.3, I have the following error. Rolling back to 0.1.1 fixes the problem.
Error message: