Skip to content

Commit cffe105

Browse files
hisanshao三少
andauthored
fix(mini):修复第三方组件样式覆盖业务组件样式的问题 #14440 (#17588)
* fix: 修复canvasContext的createLinearGradient循环调用的问题 * fix(mini):修复第三方组件样式覆盖业务组件样式的问题 #14440 --------- Co-authored-by: 三少 <[email protected]>
1 parent b6a20fe commit cffe105

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

packages/taro-webpack5-runner/src/plugins/MiniSplitChunksPlugin.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -494,17 +494,6 @@ export default class MiniSplitChunksPlugin extends SplitChunksPlugin {
494494
const chunkName = `${entryName}${ext}`
495495
const chunkAbsolutePath = path.resolve(this.distPath, chunkName)
496496
const subVendorsPath = path.join(subRoot, `${SUB_VENDORS_NAME}${ext}`)
497-
// 将子包 vendors 插入到 entry 中
498-
if (assets[normalizePath(subVendorsPath)]) {
499-
const subVendorsAbsolutePath = path.resolve(this.distPath, subVendorsPath)
500-
const vendorsRelativePath = this.getRealRelativePath(chunkAbsolutePath, subVendorsAbsolutePath)
501-
if (ext === FileExtsMap.STYLE) {
502-
source.add(`@import ${JSON.stringify(`${vendorsRelativePath}`)};`)
503-
}
504-
if (ext === FileExtsMap.JS) {
505-
source.add(`require(${JSON.stringify(`${vendorsRelativePath}`)});`)
506-
}
507-
}
508497
// 将子包下的 common 模块替换为父包下的 common 模块
509498
subCommon.forEach(moduleName => {
510499
const moduleFileName = `${moduleName}${ext}`
@@ -544,6 +533,17 @@ export default class MiniSplitChunksPlugin extends SplitChunksPlugin {
544533
}
545534
}
546535
})
536+
// 将子包 vendors 插入到 entry 中
537+
if (assets[normalizePath(subVendorsPath)]) {
538+
const subVendorsAbsolutePath = path.resolve(this.distPath, subVendorsPath)
539+
const vendorsRelativePath = this.getRealRelativePath(chunkAbsolutePath, subVendorsAbsolutePath)
540+
if (ext === FileExtsMap.STYLE) {
541+
source.add(`@import ${JSON.stringify(`${vendorsRelativePath}`)};`)
542+
}
543+
if (ext === FileExtsMap.JS) {
544+
source.add(`require(${JSON.stringify(`${vendorsRelativePath}`)});`)
545+
}
546+
}
547547
if (assets[chunkName]) {
548548
const originSource = assets[chunkName].source()
549549
if (ext === FileExtsMap.STYLE && typeof originSource === 'string') {

0 commit comments

Comments
 (0)