11
This commit is contained in:
@@ -7,7 +7,9 @@ const MiniCssExtractPlugin = require('mini-css-extract-plugin')
|
||||
const is_production = process.env.NODE_ENV === 'production' || process.argv.includes('--mode=production')
|
||||
|
||||
module.exports = {
|
||||
entry: './src/main.js',
|
||||
entry: {
|
||||
main: './src/main.js'
|
||||
},
|
||||
output: {
|
||||
path: path.resolve(__dirname, 'dist'),
|
||||
filename: 'js/[name].[contenthash:8].js',
|
||||
@@ -50,9 +52,30 @@ module.exports = {
|
||||
},
|
||||
plugins: [
|
||||
new VueLoaderPlugin(),
|
||||
// 主应用 HTML
|
||||
new HtmlWebpackPlugin({
|
||||
template: './public/index.html',
|
||||
title: 'Admin Framework Demo'
|
||||
title: 'Admin Framework Demo',
|
||||
filename: 'index.html',
|
||||
chunks: ['main']
|
||||
}),
|
||||
// 注册页面 HTML(独立页面,不依赖 webpack)
|
||||
new HtmlWebpackPlugin({
|
||||
template: './public/register.html',
|
||||
title: '邀请注册',
|
||||
filename: 'register.html',
|
||||
inject: false, // 不注入 webpack 生成的脚本
|
||||
minify: is_production ? {
|
||||
removeComments: true,
|
||||
collapseWhitespace: true,
|
||||
removeRedundantAttributes: true,
|
||||
useShortDoctype: true,
|
||||
removeEmptyAttributes: true,
|
||||
removeStyleLinkTypeAttributes: true,
|
||||
keepClosingSlash: true,
|
||||
minifyJS: true,
|
||||
minifyCSS: true
|
||||
} : false
|
||||
}),
|
||||
...(is_production ? [
|
||||
new MiniCssExtractPlugin({
|
||||
|
||||
Reference in New Issue
Block a user