Entry bundles are not generated with single runtimeChunk option

Bug report

What is the current behavior?
On webpack 4.17 when I add a single runtime option to my config runtimeChunk: { name: shared } my entry bundles are not generated.

If the current behavior is a bug, please provide the steps to reproduce.

What is the expected behavior?
I may be mistaken but my understanding of adding the single runtime option would extract the runtime code from each entry point into a single runtime chunk but leave the necessary module-exports within each entry bundle.

The issue I am currently experiencing is that splitChunks is creating multiple instances of my store for each entry point (The store we are using is extremely old and outdated, but that is out of my control ATM).

Without a single runtime option, runtime code is being added to each entry point which executes the same module multiple times – I succeeded in recreating the issue in a sandboxed environment and when I added a single runtimeChunk to my config this extracted the runtime code into a single file and resolved my issue – however when I applied this to my application – a runtime file WAS created, but my entry bundles were not.

here is my optimization config:

optimization: {
  splitChunks: {
    cacheGroups: {
      commons: {
        name: 'commons',
        filename: "js/[name].js",
        test: /\.js(x)?$/,
        chunks: "initial",
        minChunks: 1
      }
    }
  },
  runtimeChunk: {
    name: 'shared',
  },
},

Other relevant information:
webpack version: 4.17
Node.js version: 8.9
Operating System: OSX
Additional tools:

Author: Fantashit

1 thought on “Entry bundles are not generated with single runtimeChunk option

Comments are closed.