Signed-off-by: lizhouze <lizhouze@huawei.com>
This commit is contained in:
lizhouze
2022-03-09 10:18:59 +08:00
parent b081126d18
commit cd942e59bb
+26 -22
View File
@@ -143,28 +143,7 @@ let config = {
poll: false,
ignored: /node_modules/
},
optimization: {
splitChunks: {
chunks(chunk) {
return !/^\.\/workers\//.test(chunk.name) && !/^\.\/TestAbility/.test(chunk.name);
},
minSize: 0,
cacheGroups: {
vendors: {
test: /[\\/]node_modules[\\/]/,
priority: -10,
name: "vendors",
},
commons: {
test: /\.js|css|hml$/,
name: 'commons',
priority: -20,
minChunks: 2,
reuseExistingChunk: true
}
}
},
},
output: {
filename: '[name].js',
devtoolModuleFilenameTemplate: 'webpack:///[absolute-resource-path]',
@@ -298,7 +277,32 @@ module.exports = (env) => {
if (process.env.DEVICE_LEVEL === 'card') {
config.module = cardModule
config.plugins.push(new AfterEmitPlugin())
if (env.isPreview !== "true") {
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",
},
commons: {
test: /\.js|css|hml$/,
name: 'commons',
priority: -20,
minChunks: 2,
reuseExistingChunk: true
}
}
},
}
if (env.isPreview !== "true") {
notPreview(env)
}