Output is wrong when using “runtimeChunk: ‘single'” and “output.chunkFilename”

Do you want to request a feature or report a bug?
Bug

What is the current behavior?
If I have the output.chunkFilename and optimization.runtimeChunk: 'single' set, output.filename doesn’t work

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

module.exports = {
  entry: {
    'pages/page1': './src/pages/page1.js',
    'pages/page2': './src/pages/page2.js'
  },
  output: {
    filename: '[name].js',
    chunkFilename: 'chunks/[id].[chunkhash].js'
  },
  optimization: {
    runtimeChunk: 'single'
  }
};
Hash: ba1daa3725e13bf84355
Version: webpack 4.0.1
Time: 93ms
Built at: 2018-2-27 12:05:05
                           Asset       Size  Chunks             Chunk Names
chunks/0.bb1890038c33a85032a4.js  137 bytes       0  [emitted]
                      runtime.js   1.78 KiB       1  [emitted]  runtime
chunks/2.a89d98b1f66b492ba763.js  114 bytes       2  [emitted]  pages/page2
chunks/3.e244db466d72409e5de5.js  115 bytes       3  [emitted]  pages/page1
Entrypoint pages/page1 = runtime.js chunks/3.e244db466d72409e5de5.js
Entrypoint pages/page2 = runtime.js chunks/2.a89d98b1f66b492ba763.js
   [0] ./src/module.js 49 bytes {0} [built]
   [1] ./src/pages/page2.js 20 bytes {2} [built]
   [2] ./src/pages/page1.js 20 bytes {3} [built]

What is the expected behavior?
I’d expect my outputted entrypoints to look like this:

Entrypoint pages/page1 = runtime.js pages/page1.js
Entrypoint pages/page2 = runtime.js pages/page2.js

Please mention other relevant information such as the browser version, Node.js version, webpack version, and Operating System.
macOS, nodejs v9.4.0, Webpack v4.0.1

Author: Fantashit

2 thoughts on “Output is wrong when using “runtimeChunk: ‘single'” and “output.chunkFilename”

Comments are closed.