From a5c1b3283d4731a2f21ecd034190c7da1c64bf2f Mon Sep 17 00:00:00 2001 From: Evan You Date: Tue, 17 Sep 2019 16:23:29 -0400 Subject: [PATCH] chore: avoid object.freeze in prod --- packages/shared/README.md | 4 +++- packages/shared/src/index.ts | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/shared/README.md b/packages/shared/README.md index 6f4b137f13..71f4bdc2c6 100644 --- a/packages/shared/README.md +++ b/packages/shared/README.md @@ -1 +1,3 @@ -# @vue/shared \ No newline at end of file +# @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. diff --git a/packages/shared/src/index.ts b/packages/shared/src/index.ts index 19cca5ef68..06afee3179 100644 --- a/packages/shared/src/index.ts +++ b/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 = () => {} -- 2.47.3