diff --git a/webpack.config.js b/webpack.config.js index 1781633..2c63d9c 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -119,18 +119,15 @@ module.exports = { const now = new Date() const updateTime = `${now.getFullYear()}-${String(now.getMonth() + 1).padStart(2, '0')}-${String(now.getDate()).padStart(2, '0')} ${String(now.getHours()).padStart(2, '0')}:${String(now.getMinutes()).padStart(2, '0')}:${String(now.getSeconds()).padStart(2, '0')}` return [ - '/*', - ' * admin-framework v1.0.0', - ' * 通用后台管理系统框架 - 包含系统功能、登录、路由管理、布局等', - ' * ', - ' * 作者: light', - ' * 更新时间: ' + updateTime, - ' * ', - ' * Copyright (c) ' + now.getFullYear(), - ' */' + 'admin-framework v1.0.0', + '通用后台管理系统框架 - 包含系统功能、登录、路由管理、布局等', + '', + '作者: light', + '更新时间: ' + updateTime, + '', + 'Copyright (c) ' + now.getFullYear() ].join('\n') }, - raw: true, // 使用原始字符串,不添加额外的注释符号 entryOnly: true // 只在入口文件顶部添加 }) ], @@ -147,7 +144,17 @@ module.exports = { } }, optimization: { - minimize: true + minimize: true, + minimizer: [ + new (require('terser-webpack-plugin'))({ + terserOptions: { + format: { + comments: /^!|@preserve|@license|@cc_on|admin-framework|作者/i // 保留特殊注释 + } + }, + extractComments: false // 不提取注释到单独文件 + }) + ] } }