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

fix(mp): vendor chunk on windows (#3425)

上级 2550a291
......@@ -119,8 +119,8 @@ function createMoveToVendorChunkFn(): GetManualChunk {
const cache = new Map<string, boolean>()
const inputDir = normalizePath(process.env.UNI_INPUT_DIR)
return (id, { getModuleInfo }) => {
id = normalizePath(id)
const filename = id.split('?')[0]
const normalizedId = normalizePath(id)
const filename = normalizedId.split('?')[0]
// 处理项目内的js,ts文件
if (EXTNAME_JS_RE.test(filename)) {
if (filename.startsWith(inputDir) && !filename.includes('node_modules')) {
......@@ -131,19 +131,20 @@ function createMoveToVendorChunkFn(): GetManualChunk {
!chunkFileNameBlackList.includes(chunkFileName) &&
!hasJsonFile(chunkFileName) // 无同名的page,component
) {
debugChunk(chunkFileName, id)
debugChunk(chunkFileName, normalizedId)
return chunkFileName
}
return
}
// 非项目内的 js 资源,均打包到 vendor
debugChunk('common/vendor', id)
debugChunk('common/vendor', normalizedId)
return 'common/vendor'
}
if (
isVueJs(id) ||
(id.includes('node_modules') &&
!isCSSRequest(id) &&
isVueJs(normalizedId) ||
(normalizedId.includes('node_modules') &&
!isCSSRequest(normalizedId) &&
// 使用原始路径,格式化的可能找不到模块信息 https://github.com/dcloudio/uni-app/issues/3425
staticImportedByEntry(id, getModuleInfo, cache))
) {
debugChunk('common/vendor', id)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册