Why the rules of chunkFilename in webpack4 affect filename?

< H2 > question: < / H2 >

I configured both filename and chunkFilename,

  entry: {
    index: "./src/index.js",
    home:"./src/home.js"
  },
 output: {
    filename: "[name].[chunkhash:8].js",
    chunkFilename: "[name].bundle.js",
    path: resolve("dist")
  },

at the same time, I configured

  optimization:{
    runtimeChunk:true
  },

the names of the two entry files packaged at this time contain the word bundle. The question is:
chunkFilename should only affect the naming rules of non-entry chunk. Why does it affect the naming rules of entry files?

< H2 > Test: < / H2 >

after I remove the runtimeChunk:true configuration, the naming convention of the entry file is normal, and the packaged file name does not have the word bundle.

< H2 > guess: < / H2 >

does the configuration runtimeChunk:true affect naming?

< H2 > webpack.config.js < / H2 >
{
  "name": "webpack-v4",
  "version": "1.0.0",
  "main": "index.js",
  "license": "MIT",
  "scripts": {
    "dev": "set NODE_ENV=development&&webpack-dev-server --color --inline --progress --config webpack.config.js",
    "build": "webpack --config webpack.config.js"
  },
  "devDependencies": {
    "clean-webpack-plugin": "^0.1.19",
    "webpack": "^4.16.5",
    "webpack-cli": "^3.1.0",
    "webpack-dev-server": "^3.1.5"
  },
  "dependencies": {
    "bundle-loader": "^0.5.6",
    "lodash": "^4.17.10"
  }
}
Aug.05,2021

have you solved it? I also encountered this problem


has the landlord solved it?

Menu