Skip to content

Commit a70d97b

Browse files
authored
Merge pull request #2366 from didi/fix-css-atrule
fix: 修复css中不支持的AtRule中的css样式重复报错
2 parents 7f7e431 + 08e9f6b commit a70d97b

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

packages/webpack-plugin/lib/platform/style/wx/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ module.exports = function getSpec ({ warn, error }) {
3939
}
4040
// React 属性支持的枚举值
4141
const SUPPORTED_PROP_VAL_ARR = {
42-
'box-sizing': ['border-box'],
42+
'box-sizing': ['border-box', 'content-box'],
4343
'backface-visibility': ['visible', 'hidden'],
4444
overflow: ['visible', 'hidden', 'scroll'],
4545
'border-style': ['solid', 'dotted', 'dashed'],

packages/webpack-plugin/lib/react/style-helper.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,8 @@ function getClassMap ({ content, filename, mode, srcMode, ctorType, warn, error
8585
root.walkAtRules(rule => {
8686
if (rule.name !== 'media') {
8787
warn(`Only @media rule is supported in react native mode temporarily, but got @${rule.name}`)
88+
// 删除不支持的 AtRule,防止其影响后续解析
89+
rule.remove()
8890
}
8991
})
9092

0 commit comments

Comments
 (0)