diff --git a/package.json b/package.json index ee5115e..a63d872 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,7 @@ { "name": "element-pro-crud", "version": "0.8.6-1", + "author": "BoBo", "main": "lib/ProCrud.umd.min.js", "files": [ "lib", @@ -19,7 +20,6 @@ "表单设计器", "表格设计器" ], - "author": "BoBo", "repository": { "type": "git", "url": "https://github.com/BoBoooooo/Element-Pro-Crud" diff --git a/vue.config.js b/vue.config.js index 1bc3260..848e7eb 100644 --- a/vue.config.js +++ b/vue.config.js @@ -8,6 +8,9 @@ const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer'); const TerserPlugin = require('terser-webpack-plugin'); const path = require('path'); const webpack = require('webpack'); +const { + name, version, author, homepage, +} = require('./package'); function resolve(dir) { return path.join(__dirname, dir); @@ -44,7 +47,6 @@ module.exports = { }, configureWebpack: (config) => { const plugins = [ - new webpack.BannerPlugin('@author BoBo'), new TerserPlugin({ terserOptions: { compress: { @@ -56,6 +58,17 @@ module.exports = { sourceMap: false, parallel: true, }), + // 注意位置,必须放在 TerserPlugin 后面,否则生成的注释描述会被 TerserPlugin 或其它压缩插件清掉 + new webpack.BannerPlugin({ + entryOnly: true, // 是否仅在入口包中输出 banner 信息 + banner: () => `${name} v${version}` + + '\n' + + `Author: ${author}` + + '\n' + + `Documentation: ${homepage}` + + '\n' + + `Date: ${new Date()}`, + }), ]; if (process.env.NODE_ENV !== 'development') { config.plugins = [...config.plugins, ...plugins];