提交 cbb0521a 编写于 作者: fxy060608's avatar fxy060608

fix(cli): improve split-chunks #711

上级 e999a4ed
......@@ -12,6 +12,13 @@ module.exports = function getSplitChunks () {
}
}
}
const {
normalizePath
} = require('@dcloudio/uni-cli-shared')
const mainPath = normalizePath(path.resolve(process.env.UNI_INPUT_DIR, 'main.'))
if (!process.env.UNI_OPT_SUBPACKAGES) {
return {
chunks (chunk) { // 防止 node_modules 内 vue 组件被 split
......@@ -27,7 +34,8 @@ module.exports = function getSplitChunks () {
}
if (module.resource && (
module.resource.indexOf('.vue') !== -1 ||
module.resource.indexOf('.nvue') !== -1
module.resource.indexOf('.nvue') !== -1 ||
module.resource.indexOf(mainPath) === 0 // main.js
)) {
return false
}
......@@ -40,11 +48,6 @@ module.exports = function getSplitChunks () {
}
}
}
const {
normalizePath
} = require('@dcloudio/uni-cli-shared')
const mainPath = normalizePath(path.resolve(process.env.UNI_INPUT_DIR, 'main.'))
function baseTest (module) {
if (module.type === 'css/mini-extract') {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册