-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Issue with reduxtool kit and adapter-static to build SSG #7154
Comments
Please provide a minimal reproduction. There are a ton of dependencies in your |
Sorry for that --> Here is the minimal version: https://github.com/harrytran998/sveltekit-test.git 💡 Attention: This run well in I think this issue relates to the ESM problem. When Vite run in order ESM first --> will load This file exposes // src/index.ts
enableES5();
export { configureStore, .... }; BCS when I tried to change a little bit with the above repo // import * as toolkit from '@reduxjs/toolkit'
import { configureStore } from '@reduxjs/toolkit'
import { promotion } from './modules/promotion'
// const { configureStore } = toolkit
export const store = configureStore({
reducer: {
promotion: promotion.reducer,
},
}) The error will display more clearer.
@Conduitry So you have any suggestions for this issue? Besides redux problems, I also face the redux-persist problem with the ESM issue. |
My package.json is more minimal now, can you support me @Conduitry |
Add |
https://publint.bjornlu.com/@reduxjs/toolkit@1.8.6 looks like they have a cjs package but provide a module field? on top of that it use the infamous .esm.js extension instead of .mjs Looks like suboptimal packaging on their end to me and noExternal being a workaround. The solution would be redux toolkit offering a proper esm package |
@dummdidumm thank you so much for your workaround. |
Yeah, I think currently it is an acceptable solution. Bcs I think the redux toolkit should do that for the mask of development. Besides Redux Toolkit, we use a lot of dependencies like |
This has already been reported as a bug in redux-toolkit: reduxjs/redux-toolkit#1960. I will close this in favor of that issue
The majority of dependencies work just fine. You can force a poorly packaged dependency to be bundled with the |
@dominikg improving our RTK package publishing and module exporting has been high on my todo list for a long time. However, that would be a breaking change, so it has to wait for RTK 2.0. We've had many other things on our plate, so 2.0 has had to wait for a while. However, we just put out 1.9 beta, and once 1.9 is out the door I do want to move ahead quickly and start tackling changes for 2.0. No ETA on that, but this is the next priority for us. |
Describe the bug
it works on SSR and CSR, but SSG doesn't, when I config to build SSG, it logs errors about reduxtoolkit
TypeError: configureStore is not a function
at file:///.../my-app/.svelte-kit/output/server/entries/pages/_layout.svelte.js:41:15
at ModuleJob.run (node:internal/modules/esm/module_job:193:25)
at async Promise.all (index 0)
at async ESMLoader.import (node:internal/modules/esm/loader:533:24)
at async Module.component (file:///my-app/.svelte-kit/output/server/nodes/0.js:4:39)
at async Promise.all (index 0)
at async render_response (file://.../my-app/.svelte-kit/output/server/index.js:1218:19)
at async render_page (file://.../my-app/.svelte-kit/output/server/index.js:1676:12)
at async resolve (file://.../my-app/.svelte-kit/output/server/index.js:1981:22)
at async respond (file://.../my-app/.svelte-kit/output/server/index.js:2019:22)
[vite-plugin-svelte-kit] Prerendering failed with code 1
error during build:
Error: Prerendering failed with code 1
at ChildProcess. (file:///.../my-app/node_modules/@sveltejs/kit/src/exports/vite/index.js:438:15)
at ChildProcess.emit (node:events:513:28)
at Process.ChildProcess._handle.onexit (node:internal/child_process:291:12)
Process finished with exit code 1
Reproduction
https://github.com/Linh2196/sveltekit-test
Logs
System Info
Severity
blocking an upgrade
Additional Information
In older sveltekit, (1.0.0-next.168) it 's running stable. But I want to upgrade to latest version
The text was updated successfully, but these errors were encountered: