From 76b358445e18defd0f0db36246bf2359d73b73c3 Mon Sep 17 00:00:00 2001 From: Chuwen Date: Wed, 23 Feb 2022 23:26:37 +0800 Subject: [PATCH] =?UTF-8?q?build:=20=E4=BC=98=E5=8C=96=E6=89=93=E5=8C=85?= =?UTF-8?q?=E4=BD=93=E7=A7=AF=20(#1323)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 移除生产环境不必要的 map 文件 * webpack 添加 LimitChunkCountPlugin 用以解决 chunk 包太多的问题 --- vue.config.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/vue.config.js b/vue.config.js index 5ba16f6..b24d638 100644 --- a/vue.config.js +++ b/vue.config.js @@ -1,9 +1,12 @@ +const webpack = require('webpack'); const path = require('path'); function resolve(dir) { return path.join(__dirname, dir); } module.exports = { + // 生产环境打包不输出 map + productionSourceMap: false, devServer: { disableHostCheck: true, port: process.env.DEV_SERVER_PORT || 8080, @@ -53,6 +56,13 @@ module.exports = { symbolId: 'icon-[name]', }) .end(); + // LimitChunkCountPlugin 可以通过合并块来对块进行后期处理。用以解决 chunk 包太多的问题 + config.plugin('chunkPlugin').use(webpack.optimize.LimitChunkCountPlugin, [ + { + maxChunks: 3, + minChunkSize: 10_000, + }, + ]); }, // 添加插件的配置 pluginOptions: {