loadable-components: SSR is not work when adding vendor split chunks

🐛 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)

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 15 (1 by maintainers)

Most upvoted 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 the not-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.