const actualClassSet = toClassSet(actual || '')
const expectedClassSet = toClassSet(expected)
- const hasMismatch = isIncremental
- ? // check if the expected classes are present in the actual classes
- Array.from(expectedClassSet).some(cls => !actualClassSet.has(cls))
- : !isSetEqual(actualClassSet, expectedClassSet)
+ let hasMismatch: boolean = false
+ if (isIncremental) {
+ if (expectedClassSet.size > 0) {
+ hasMismatch = Array.from(expectedClassSet).some(
+ cls => !actualClassSet.has(cls),
+ )
+ }
+ } else {
+ hasMismatch = !isSetEqual(actualClassSet, expectedClassSet)
+ }
if (hasMismatch) {
warnPropMismatch(el, 'class', MismatchTypes.CLASS, actual, expected)
// TODO: handle css vars
- const hasMismatch = isIncremental
- ? // check if the expected styles are present in the actual styles
- Array.from(expectedStyleMap.entries()).some(
+ let hasMismatch: boolean = false
+ if (isIncremental) {
+ if (expectedStyleMap.size > 0) {
+ // check if the expected styles are present in the actual styles
+ hasMismatch = Array.from(expectedStyleMap.entries()).some(
([key, val]) => actualStyleMap.get(key) !== val,
)
- : !isMapEqual(actualStyleMap, expectedStyleMap)
+ }
+ } else {
+ hasMismatch = !isMapEqual(actualStyleMap, expectedStyleMap)
+ }
if (hasMismatch) {
warnPropMismatch(el, 'style', MismatchTypes.STYLE, actual, expected)
file: outputConfigs[format].file.replace(/\.js$/, '.prod.js'),
},
[
- {
- name: 'swc-minify',
-
- async renderChunk(contents, _, { format }) {
- const { code } = await minifySwc(contents, {
- module: format === 'es',
- format: {
- comments: false,
- },
- compress: {
- ecma: 2016,
- pure_getters: true,
- },
- safari10: true,
- mangle: true,
- })
-
- return { code: banner + code, map: null }
- },
- },
+ // {
+ // name: 'swc-minify',
+ // async renderChunk(contents, _, { format }) {
+ // const { code } = await minifySwc(contents, {
+ // module: format === 'es',
+ // format: {
+ // comments: false,
+ // },
+ // compress: {
+ // ecma: 2016,
+ // pure_getters: true,
+ // },
+ // safari10: true,
+ // mangle: true,
+ // })
+ // return { code: banner + code, map: null }
+ // },
+ // },
],
)
}