1 Star 0 Fork 0

Milky/allure_vue

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
webpack.prod.js 1.41 KB
一键复制 编辑 原始数据 按行查看 历史
Milky 提交于 2019-03-15 14:06 . 账号页面基本完成
const path = require('path');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');//生产环境下抽离出css模块
const OptimizeCSSAssetsPlugin = require("optimize-css-assets-webpack-plugin");//生产环境下压缩css模块
const UglifyJsPlugin = require("uglifyjs-webpack-plugin");//生产环境下压缩js模块
const merge = require('webpack-merge');
const common = require('./webpack.common');
let prodConfig = {
mode: 'production',
output: {
filename: "[name]-main.[hash].js",
path: path.resolve(__dirname, 'dist')
},
module: {
rules: [
{
test: /\.(sc|sa|c)ss$/, use: [ MiniCssExtractPlugin.loader//对抽离css模块的配置,此时将不再使用style-loader
, {
loader: 'css-loader',
options: {sourceMap: true}
}, {
loader: 'sass-loader',
options: {sourceMap: true}
}]
}
]
},
plugins: [
new MiniCssExtractPlugin({
filename: "[name].[hash].css",
chunkFilename: "[id].[hash].css"
})//对抽离css模块的配置
],
optimization: {
minimizer: [
new UglifyJsPlugin({//压缩js文件,production下有用
cache: true,
parallel: true,
sourceMap: true // set to true if you want JS source maps
}),
new OptimizeCSSAssetsPlugin({})//压缩css文件,production下有用
]
}
};
module.exports = merge(common,prodConfig);
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/Milky__Way/allure_vue.git
git@gitee.com:Milky__Way/allure_vue.git
Milky__Way
allure_vue
allure_vue
master

搜索帮助