roathog配置的react文件能大大简化我们的配置难度,但是有时候我们又必须使用webpack的强大的功能,这时我们就需要写webpack.config.js,配置如下:
const webpack = require('webpack')
const QiniuPlugin = require('qiniu-webpack-plugin')
const config = require('./secret')
module.exports = function (webpackConfig, env) {
if (env !== 'production') {} else {
webpackConfig.plugins.push(
new webpack.optimize.UglifyJsPlugin({
compress: {
warnings: false,
drop_debugger: true,
drop_console: true
}
}),
new QiniuPlugin({
ACCESS_KEY: config.ACCESS_KEY,
SECRET_KEY: config.SECRET_KEY,
bucket: 'test',
path: 'fe/'
})
)
}
return webpackConfig
}