This commit is contained in:
张成
2025-12-19 15:54:52 +08:00
parent 4db1f77536
commit cfbcbc39fd
8 changed files with 1097 additions and 456 deletions

View File

@@ -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({