فهرست منبع

chore: avoid object.freeze in prod

Evan You 6 سال پیش
والد
کامیت
a5c1b3283d
2فایلهای تغییر یافته به همراه6 افزوده شده و 2 حذف شده
  1. 3 1
      packages/shared/README.md
  2. 3 1
      packages/shared/src/index.ts

+ 3 - 1
packages/shared/README.md

@@ -1 +1,3 @@
-# @vue/shared
+# @vue/shared
+
+Utility functions and constants shared across packages. This package itself is private and never published. It is inlined into other packages during build - rollup's tree-shaking ensures that only functions used by the importing package are included.

+ 3 - 1
packages/shared/src/index.ts

@@ -1,4 +1,6 @@
-export const EMPTY_OBJ: { readonly [key: string]: any } = Object.freeze({})
+export const EMPTY_OBJ: { readonly [key: string]: any } = __DEV__
+  ? Object.freeze({})
+  : {}
 export const EMPTY_ARR: [] = []
 
 export const NOOP = () => {}