What is the difference between webpack.base.config.js and webpack.config.js in webpack?

clipboard.png

there are webpack.config.js
what"s the difference between these files, or are they randomly named? How does webpack identify it?

Mar.20,2021

The name of

can be chosen at will, and finally depends on which js
package.json you call

in the scripts of your package.json call.
"scripts": {
    "dll": "webpack -p --config webpack.dll.config.js --progress --profile --colors",
    "dev": "node server.js",
    "build": "webpack -p --config webpack.config.js --progress --profile --colors"
  }

webpack only knows webpack.config.js; by default

webpack//webpack.config.js;
webpack --config webpack.config_test.js//

 :
//server.js
.....
const webpackDevConfig = require('./build/webpack.dev.config');
......
if (config.isdev) {
console.log('server')
const compiler = webpack(webpackDevConfig)
.....//

}


what's the difference between these files, or are they randomly named?
The

name is optional, but we name it to make something meaningful, don't we?
prod is used for production packaging, and dev is used for development packaging. As you can imagine, prod and dev must have some of the same configuration, plus some different configurations. So the same configuration is put into base, and then prod and dev introduce base, to add different details.

how does webpack identify it?

look at your package.json

Menu