From: Evan You Date: Tue, 17 Sep 2019 20:23:29 +0000 (-0400) Subject: chore: avoid object.freeze in prod X-Git-Tag: v3.0.0-alpha.0~754 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=a5c1b3283d4731a2f21ecd034190c7da1c64bf2f;p=thirdparty%2Fvuejs%2Fcore.git chore: avoid object.freeze in prod --- 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 = () => {}