Просмотр исходного кода

fix(runtime-core): add dev warning for silent catch in compat mode and fix test description typo (#14891)

Paijo 2 дней назад
Родитель
Сommit
db3e117025

+ 5 - 1
packages/runtime-core/src/compat/global.ts

@@ -631,7 +631,11 @@ function defineReactive(obj: any, key: string, val: any) {
       Object.keys(val).forEach(key => {
         try {
           defineReactiveSimple(val, key, val[key])
-        } catch (e: any) {}
+        } catch (e: any) {
+          if (__DEV__) {
+            warn(`Failed making property "${key}" reactive:`, e)
+          }
+        }
       })
     }
   }

+ 1 - 1
packages/vue/__tests__/index.spec.ts

@@ -190,7 +190,7 @@ describe('compiler + runtime integration', () => {
     expect('[Vue warn]: invalid template option:').toHaveBeenWarned()
   })
 
-  it('should warn when template is is not found', () => {
+  it('should warn when template is not found', () => {
     const app = createApp({
       template: '#not-exist-id',
     })