1 Star 0 Fork 0

monw3c / common-build-tool

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
webpack.prod.config.js 2.09 KB
一键复制 编辑 原始数据 按行查看 历史
const path = require('path');
const webpack = require("webpack");
const config = require('./webpack.base.config');
const HtmlWebpackPlugin = require('html-webpack-plugin');
//const path = require('path');
//const ExtractTextPlugin = require('extract-text-webpack-plugin');
//const extractCSS = new ExtractTextPlugin('css/[name][contenthash].css');
const glob = require('glob');
const PurifyCSSPlugin = require('purifycss-webpack');
const CleanWebpackPlugin = require('clean-webpack-plugin');
//const vendor = [path.resolve(__dirname,"./src/js/libs/jquery203.js")];
config.plugins.push(
new PurifyCSSPlugin({
paths: glob.sync(path.join(__dirname, 'src/*.html')),
minimize:true
}),
//new webpack.BannerPlugin('Github:https://github.com/monw3c'),
//new webpack.HotModuleReplacementPlugin(), //热加载插件
new CleanWebpackPlugin(['./build'], {
root: '',
verbose: true,
dry: false
}),
new webpack.optimize.OccurrenceOrderPlugin(),
new webpack.optimize.UglifyJsPlugin({
uglifyOptions: {
ie8: false,
output: {
comments: false,
beautify: false,
},
mangle: {
keep_fnames: true
},
compress: {
warnings: false,
drop_console: true
},
}
}),
new webpack.optimize.ModuleConcatenationPlugin(),
new HtmlWebpackPlugin({
filename: 'index.html',
template: __dirname + "/src/index.tmpl.html",
thunks: ['common', 'index'],
excludeChunks: ['list'],
minify: { //压缩HTML文件
removeComments: true, //移除HTML中的注释
collapseWhitespace: true //删除空白符与换行符
}
}),
new HtmlWebpackPlugin({
filename: 'list.html',
template: __dirname + "/src/list.tmpl.html",
thunks: ['common', 'list'],
excludeChunks: ['index']
})
)
module.exports = config;
JavaScript
1
https://gitee.com/monw3c/common-build-tool.git
git@gitee.com:monw3c/common-build-tool.git
monw3c
common-build-tool
common-build-tool
master

搜索帮助