Appearance
多环境配置
大型项目开发时,多种不同开发环境需要配置不同环境。
多环境合并需要使用webpack-merge
javascript
// webpack.prod.js
const common = require('./webpack.common')
const merge = require('webpack-merge')
const { CleanWebpackPlugin } = require('clean-webpack-plugin')
const CopyWebpackPlugin = require('copy-webpack-plugin')
module.exports = merge(common, {
mode: 'production',
plugins: [
new CleanWebpackPlugin(),
new CopyWebpackPlugin(['public'])
]
})