Skip to content

Commit bc55372

Browse files
authored
Merge pull request #2259 from didi/fix-component-is
fix: 修复componentis输出web&rn报错
2 parents 89b3c82 + 9116ef1 commit bc55372

6 files changed

Lines changed: 13 additions & 3 deletions

File tree

packages/webpack-plugin/lib/loader.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,8 @@ module.exports = function (content) {
147147
hasScoped,
148148
hasComment,
149149
isNative,
150-
usingComponentsInfo: JSON.stringify(usingComponentsInfo),
150+
usingComponentsInfo,
151+
originalUsingComponents,
151152
componentGenerics,
152153
autoScope,
153154
callback
@@ -169,7 +170,8 @@ module.exports = function (content) {
169170
hasScoped,
170171
hasComment,
171172
isNative,
172-
usingComponentsInfo: JSON.stringify(usingComponentsInfo),
173+
usingComponentsInfo,
174+
originalUsingComponents,
173175
componentGenerics,
174176
autoScope,
175177
callback

packages/webpack-plugin/lib/react/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ module.exports = function ({
2121
hasComment,
2222
isNative,
2323
usingComponentsInfo,
24+
originalUsingComponents,
2425
componentGenerics,
2526
autoScope,
2627
callback
@@ -53,6 +54,7 @@ module.exports = function ({
5354
moduleId,
5455
ctorType,
5556
usingComponentsInfo,
57+
originalUsingComponents,
5658
componentGenerics
5759
}, callback)
5860
},

packages/webpack-plugin/lib/react/processTemplate.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ module.exports = function (template, {
1717
moduleId,
1818
ctorType,
1919
usingComponentsInfo,
20+
originalUsingComponents,
2021
componentGenerics
2122
}, callback) {
2223
const mpx = loaderContext.getMpx()
@@ -68,6 +69,7 @@ module.exports = function (template, {
6869
warn,
6970
error,
7071
usingComponentsInfo, // processTemplate中无其他地方使用,直接透传 string 类型
72+
originalUsingComponents,
7173
hasComment,
7274
isNative,
7375
ctorType,

packages/webpack-plugin/lib/template-compiler/compiler.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1014,7 +1014,7 @@ function processComponentIs (el, options) {
10141014
ranges = range.split(',').map(i => i.trim()).filter(i => i)
10151015
} else {
10161016
// 根据原始用户写的usingComponents字段生成ranges
1017-
ranges = options.originalUsingComponents
1017+
ranges = options.originalUsingComponents || []
10181018
}
10191019

10201020
const rangeMap = new Map()

packages/webpack-plugin/lib/web/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ module.exports = function ({
2121
hasComment,
2222
isNative,
2323
usingComponentsInfo,
24+
originalUsingComponents,
2425
componentGenerics,
2526
autoScope,
2627
callback
@@ -70,6 +71,7 @@ module.exports = function ({
7071
moduleId,
7172
ctorType,
7273
usingComponentsInfo,
74+
originalUsingComponents,
7375
componentGenerics
7476
}, callback)
7577
},

packages/webpack-plugin/lib/web/processTemplate.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ module.exports = function (template, {
1313
moduleId,
1414
ctorType,
1515
usingComponentsInfo,
16+
originalUsingComponents,
1617
componentGenerics
1718
}, callback) {
1819
const mpx = loaderContext.getMpx()
@@ -77,6 +78,7 @@ module.exports = function (template, {
7778
warn,
7879
error,
7980
usingComponentsInfo, // processTemplate中无其他地方使用,直接透传 string 类型
81+
originalUsingComponents,
8082
hasComment,
8183
isNative,
8284
ctorType,

0 commit comments

Comments
 (0)