From 4c27f1bfc14ceff01e18785b88a16ff29bae6cdd Mon Sep 17 00:00:00 2001 From: fangjiapeng Date: Thu, 17 Aug 2023 14:40:10 +0800 Subject: [PATCH] =?UTF-8?q?build:=20=E4=BD=BF=E7=94=A8contentHash=E7=94=9F?= =?UTF-8?q?=E6=88=90js=EF=BC=9B=E4=BF=AE=E5=A4=8D=E6=9C=AC=E5=9C=B0?= =?UTF-8?q?=E8=BF=90=E8=A1=8C=E7=83=AD=E6=9B=B4=E6=96=B0=E6=85=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hoj-vue/vue.config.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/hoj-vue/vue.config.js b/hoj-vue/vue.config.js index d6e735656..2f27b9c81 100644 --- a/hoj-vue/vue.config.js +++ b/hoj-vue/vue.config.js @@ -88,11 +88,16 @@ module.exports={ config.plugin('webpack-bundle-analyzer') // 查看打包文件体积大小 .use(require('webpack-bundle-analyzer').BundleAnalyzerPlugin) // ============注入cdn end============ + if(isProduction) { + config.output.filename('assets/js/app.[contentHash].js') + } else { + config.output.filename('assets/js/app.js') + } }, configureWebpack: (config) => { // 用cdn方式引入,则构建时要忽略相关资源 const plugins = []; - if (isProduction || devNeedCdn){ + if (isProduction){ config.externals = cdn.externals config.mode = 'production'; config["performance"] = {//打包文件大小配置 @@ -125,6 +130,8 @@ module.exports={ minRatio: 0.8 // 压缩比 }) ) + } else { + config.externals = cdn.externals } }