SSR is not work when adding vendor split chunks
See original GitHub issue🐛 Bug Report
When using the SSR example of this repo, and adding vendor split chunks
To Reproduce
Run this project https://github.com/gregberge/loadable-components/blob/master/examples/server-side-rendering/
with the following addon to the webpack config:
optimization: {
splitChunks: {
cacheGroups: {
vendor: {
test: /node_modules/,
chunks: 'initial',
name: 'vendor',
enforce: true
},
}
},
runtimeChunk: true
},
Expected behavior
Split vendor modules
Results:
Server started http://localhost:9000
// Performing request
Error: Minified React error #130; visit https://reactjs.org/docs/error-decoder.html?invariant=130&args[]=undefined&args[]= for the full message or use the non-minified dev environment for full errors and additional helpful warnings.
at a.b.render (/Users/idangozlan/tovia/tests/loadable-components/examples/server-side-rendering/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:48:37)
at a.b.read (/Users/idangozlan/tovia/tests/loadable-components/examples/server-side-rendering/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:44:18)
at renderToString (/Users/idangozlan/tovia/tests/loadable-components/examples/server-side-rendering/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:54:364)
at app.get (/Users/idangozlan/tovia/tests/loadable-components/examples/server-side-rendering/lib/server/main.js:57:43)
at Layer.handle [as handle_request] (/Users/idangozlan/tovia/tests/loadable-components/examples/server-side-rendering/node_modules/express/lib/router/layer.js:95:5)
at next (/Users/idangozlan/tovia/tests/loadable-components/examples/server-side-rendering/node_modules/express/lib/router/route.js:137:13)
at Route.dispatch (/Users/idangozlan/tovia/tests/loadable-components/examples/server-side-rendering/node_modules/express/lib/router/route.js:112:3)
at Layer.handle [as handle_request] (/Users/idangozlan/tovia/tests/loadable-components/examples/server-side-rendering/node_modules/express/lib/router/layer.js:95:5)
at /Users/idangozlan/tovia/tests/loadable-components/examples/server-side-rendering/node_modules/express/lib/router/index.js:281:22
at param (/Users/idangozlan/tovia/tests/loadable-components/examples/server-side-rendering/node_modules/express/lib/router/index.js:354:14)
Issue Analytics
- State:
- Created 4 years ago
- Comments:14 (1 by maintainers)
Top Results From Across the Web
Lazy load on React SSR with Code Splitting - Medium
Webpack configuration First, we need to install Webpack and Babel packages with its plugins. Then, we need to install react-loadable-ssr-addon ...
Read more >[Webpack][React] On SSR with code-splitting how I can get the ...
Use the webpack-manifest-plugin to generate a manifest.json file that will include a list of all your chunks. In your webpack.config.js :
Read more >Caching - webpack
Running our build script, npm run build , with this configuration should produce the following output: ... Asset Size Chunks Chunk Names main....
Read more >The build Property - Nuxt
If you are not using yarn you can run the command with npx . ... export default { build: { extractCSS: true, optimization:...
Read more >How code splitting works in FTW - Sharetribe
chunk.js). I.e. those code-paths are separated from the main bundle. Previously, (when code-splitting was not supported), when you ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hello. As a quickfix reversing the assets array before finding the first asset matching the scriptType, seems to fix the problem. I’m able to get both runtimeChunk and splitChunks to work.
I guess I should add that by “working” I mean not getting this exact error, but I still couldn’t get a project working based on the SSR example (meaning with the webpack multi compiler and using nodeExtractor.requireEntrypoint()).
I have an example here of something that does work, without the multi compiler, and not using requireEntrypoint: https://github.com/adbutterfield/fast-refresh-express
(If interested, not working version is on thenot-working
branch here:https://github.com/adbutterfield/fast-refresh-express/tree/not-working)Edit: I did finally get a working example using the multi compiler here: https://github.com/adbutterfield/fast-refresh-express/tree/multi-compiler.