]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
fix: don't warn when incremental value is empty
authordaiwei <daiwei521@126.com>
Mon, 22 Sep 2025 07:01:18 +0000 (15:01 +0800)
committerdaiwei <daiwei521@126.com>
Mon, 22 Sep 2025 07:01:18 +0000 (15:01 +0800)
packages/runtime-vapor/src/dom/prop.ts
rollup.config.js

index 22189c822b3e0497235eb8953e889716dbf1069e..0a4c21739b94fa53b021fdc564e729e0cc9781ce 100644 (file)
@@ -425,10 +425,16 @@ function classHasMismatch(
   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)
@@ -457,12 +463,17 @@ function styleHasMismatch(
 
   // 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)
index 1fa345f87fc926876c4f7787abde1a83e43db15b..05e2e0e8e86deac67a85c337b1170f5c98049df5 100644 (file)
@@ -392,26 +392,24 @@ function createMinifiedConfig(/** @type {PackageFormat} */ format) {
       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 }
+      //   },
+      // },
     ],
   )
 }