From e513185dd824319c123bd49f79506c7ebcdc8666 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E6=88=90?= Date: Wed, 8 Oct 2025 15:37:45 +0800 Subject: [PATCH] 1 --- webpack.config.js | 54 ++++++++++++++++++----------------------------- 1 file changed, 21 insertions(+), 33 deletions(-) diff --git a/webpack.config.js b/webpack.config.js index 675124b..1d2f521 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -1,37 +1,6 @@ -/** - * Admin Framework Webpack 配置 - * - * 文件命名规则说明: - * - * 1. 图片文件 (images/) - * - SVG 图标: images/svg/[name].[hash:7].svg - * - PNG 图片: images/png/[name].[hash:7].png - * - JPG 图片: images/jpg/[name].[hash:7].jpg - * - GIF 动图: images/gif/[name].[hash:7].gif - * - * 2. 字体文件 (fonts/) - * - WOFF/WOFF2: fonts/woff/[name].[hash:7].woff(2) - * - TTF: fonts/ttf/[name].[hash:7].ttf - * - EOT: fonts/eot/[name].[hash:7].eot - * - OTF: fonts/otf/[name].[hash:7].otf - * - * 3. 媒体文件 (media/) - * - 视频: media/video/[name].[hash:7].mp4/webm/ogg - * - 音频: media/audio/[name].[hash:7].mp3/wav/flac/aac - * - * 4. 数据文件 (data/) - * - JSON: data/[name].[hash:7].json - * - * 5. 其他资源 (assets/) - * - TXT/XML/MD: assets/[name].[hash:7].txt/xml/md - * - * 命名占位符说明: - * - [name]: 原始文件名 - * - [hash:7]: 7 位内容哈希(用于缓存控制) - * - [ext]: 文件扩展名(包含点号) - */ const path = require('path') +const webpack = require('webpack') const { VueLoaderPlugin } = require('vue-loader') module.exports = { @@ -187,7 +156,26 @@ module.exports = { ] }, plugins: [ - new VueLoaderPlugin() + new VueLoaderPlugin(), + new webpack.BannerPlugin({ + banner: () => { + 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(), + ' */' + ].join('\n') + }, + raw: true, // 使用原始字符串,不添加额外的注释符号 + entryOnly: true // 只在入口文件顶部添加 + }) ], resolve: { extensions: ['.js', '.vue', '.json'],