question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

RuntimeIdRuntimeModule must be in a single runtime LimitChunkCountPlugin maxChunks 1

See original GitHub issue

For building a lib i want to disable codeSplitting with webpack

adding the LimitChunkCountPlugin

   plugins: [
    new webpack.optimize.LimitChunkCountPlugin({
      maxChunks: 1,
    }),
  ],

but get this error on build

ERROR in webpack/runtime/runtimeId
RuntimeIdRuntimeModule must be in a single runtime
Error: RuntimeIdRuntimeModule must be in a single runtime
    at RuntimeIdRuntimeModule.generate (/home/arpu/Work/projects/vland_app/vland_app/node_modules/webpack/lib/runtime/RuntimeIdRuntimeModule.js:22:10)
    at RuntimeIdRuntimeModule.getGeneratedCode (/home/arpu/Work/projects/vland_app/vland_app/node_modules/webpack/lib/RuntimeModule.js:182:44)
    at RuntimeIdRuntimeModule.codeGeneration (/home/arpu/Work/projects/vland_app/vland_app/node_modules/webpack/lib/RuntimeModule.js:137:30)
    at /home/arpu/Work/projects/vland_app/vland_app/node_modules/webpack/lib/Compilation.js:3324:22
    at /home/arpu/Work/projects/vland_app/vland_app/node_modules/webpack/lib/Cache.js:93:5
    at Hook.eval [as callAsync] (eval at create (/home/arpu/Work/projects/vland_app/vland_app/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:6:1)
    at Cache.get (/home/arpu/Work/projects/vland_app/vland_app/node_modules/webpack/lib/Cache.js:75:18)
    at ItemCacheFacade.get (/home/arpu/Work/projects/vland_app/vland_app/node_modules/webpack/lib/CacheFacade.js:111:15)
    at Compilation._codeGenerationModule (/home/arpu/Work/projects/vland_app/vland_app/node_modules/webpack/lib/Compilation.js:3317:9)
    at /home/arpu/Work/projects/vland_app/vland_app/node_modules/webpack/lib/Compilation.js:3224:11

without the plugin all works fine

node v14.19.0 webpack 5.69.1

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
alexander-akaitcommented, Aug 17, 2022

When you have native support for Web Workers, you always have more than 1 chunk… You can try:

new webpack.optimize.LimitChunkCountPlugin({
      maxChunks: 2,
}),
0reactions
mohsinulhaqcommented, Aug 17, 2022

@alexander-akait For me, the error started popping up after I removed worker-loader in favor of Webpack 5’s native support for Web Workers. I am sure it’s caused due to LimitChunkCountPlugin because disabling it causes builds to pass.

Read more comments on GitHub >

github_iconTop Results From Across the Web

LimitChunkCountPlugin max chunks not working for dynamic ...
Webpack 5 creates chunks even though maxChunks set to 1 only with 2 JS entry points # ... RuntimeIdRuntimeModule must be in a...
Read more >
LimitChunkCountPlugin - webpack
LimitChunkCountPlugin can post-process your chunks by merging them. ... Limit the maximum number of chunks using a value greater than or equal to...
Read more >
Webpack ignore chunking for production build - Stack Overflow
You can disable code splitting by limiting the max number of chunks to 1 with the LimitChunkCountPlugin : plugins: [ new webpack.optimize.
Read more >
The Single Runtime Chunk > Webpack Encore - SymfonyCasts
Every single entry now includes a new file called runtime.js , which means that it's a new file that needs to be included...
Read more >
How to disable Code Splitting in webpack | Glenn Reyes
LimitChunkCountPlugin ({ maxChunks: 1, }), ],};. With this, one single chunk/bundle will be created and voila: Code Splitting is disabled. So in ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found