代码拉取完成,页面将自动刷新
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;
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。