./build
- build
- webpack.common.js
- webpack.dev.js
- webpack.prod.js
webpack.common.js
module.exports = {
entry:
output:
plugins:
module:
...
}
webpack.dev.js
const { merge } = require('webpack-merge')
const commonConfig = require('./webpack.common')
const devConfig = {
mode: 'development',
devtool:
devServer:
plugins:
...
}
module.exports = merge(commonConfig, devConfig)
webpack.prod.js
const { merge } = require('webpack-merge')
const commonConfig = require('./webpack.common')
const prodConfig = {
mode: 'production',
devtool:
...
}
module.exports = merge(commonConfig, prodConfig)
package.json
{
"scripts": {
"serve": "webpack-dev-server --config ./build/webpack.dev.js",
"build": "webpack --config ./build/webpack.prod.js"
},
}