From 4451ce478c9cab683bc06a3861b96775c7cb37bf Mon Sep 17 00:00:00 2001 From: toesbieya <1647775459@qq.com> Date: Tue, 29 Dec 2020 12:23:18 +0800 Subject: [PATCH] =?UTF-8?q?=E7=94=9F=E4=BA=A7=E6=A8=A1=E5=BC=8F=E4=B8=8B?= =?UTF-8?q?=E5=B0=86=E6=89=80=E6=9C=89css=E5=90=88=E5=B9=B6=E5=88=B0?= =?UTF-8?q?=E4=B8=80=E4=B8=AA=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vue/full/vue.config.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/vue/full/vue.config.js b/vue/full/vue.config.js index a8980e8..06b4cbe 100644 --- a/vue/full/vue.config.js +++ b/vue/full/vue.config.js @@ -83,5 +83,21 @@ module.exports = { .loader('svg-sprite-loader') .options({symbolId: 'icon-[name]'}) .end() + + //将css合并到一个文件中 + //https://github.com/vuejs/vue-cli/issues/2843 + config.when(!settings.isDev, config => { + config.optimization.splitChunks({ + cacheGroups: { + styles: { + name: 'styles', + test: (m) => /css\/mini-extract/.test(m.type), + chunks: 'all', + minChunks: 1, + enforce: true, + }, + } + }) + }) } }