From 9356295ced74dad418d5b0690be02e47900b8926 Mon Sep 17 00:00:00 2001 From: lizhouze Date: Wed, 13 Apr 2022 15:20:21 +0800 Subject: [PATCH] lizhouze@huawei.com Signed-off-by: lizhouze --- ace-loader/webpack.rich.config.js | 40 ++++++++++++++++--------------- 1 file changed, 21 insertions(+), 19 deletions(-) diff --git a/ace-loader/webpack.rich.config.js b/ace-loader/webpack.rich.config.js index 8b34c67..e742d44 100644 --- a/ace-loader/webpack.rich.config.js +++ b/ace-loader/webpack.rich.config.js @@ -281,27 +281,29 @@ module.exports = (env) => { notPreview(env) } } else { - config.optimization = { - splitChunks: { - chunks(chunk) { - return !/^\.\/workers\//.test(chunk.name) && !/^\.\/TestAbility/.test(chunk.name); - }, - minSize: 0, - cacheGroups: { - vendors: { - test: /[\\/]node_modules[\\/]/, - priority: -10, - name: "vendors", + if (process.env.abilityType === 'page') { + config.optimization = { + splitChunks: { + chunks(chunk) { + return !/^\.\/workers\//.test(chunk.name) && !/^\.\/TestAbility/.test(chunk.name); }, - commons: { - test: /\.js|css|hml$/, - name: 'commons', - priority: -20, - minChunks: 2, - reuseExistingChunk: true + minSize: 0, + cacheGroups: { + vendors: { + test: /[\\/]node_modules[\\/]/, + priority: -10, + name: "vendors", + }, + commons: { + test: /\.js|css|hml$/, + name: 'commons', + priority: -20, + minChunks: 2, + reuseExistingChunk: true + } } - } - }, + }, + } } if (env.isPreview !== "true") { notPreview(env)