From: Evan You Date: Tue, 26 Dec 2023 07:26:29 +0000 (+0800) Subject: refactor: adjust warn method treeshaking X-Git-Tag: v3.4.0-rc.2~4 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=73ae6adbb1de7bb19722071c3129257849ee3947;p=thirdparty%2Fvuejs%2Fcore.git refactor: adjust warn method treeshaking --- diff --git a/packages/runtime-core/src/index.ts b/packages/runtime-core/src/index.ts index 232afba46f..422d7e772a 100644 --- a/packages/runtime-core/src/index.ts +++ b/packages/runtime-core/src/index.ts @@ -116,7 +116,9 @@ export { useSSRContext, ssrContextKey } from './helpers/useSsrContext' export { createRenderer, createHydrationRenderer } from './renderer' export { queuePostFlushCb } from './scheduler' -export { warn } from './warning' +import { warn as _warn } from './warning' +export const warn = (__DEV__ ? _warn : NOOP) as typeof _warn + /** @internal */ export { assertNumber } from './warning' export { diff --git a/packages/runtime-core/src/warning.ts b/packages/runtime-core/src/warning.ts index 67e4ee3125..45284fc70c 100644 --- a/packages/runtime-core/src/warning.ts +++ b/packages/runtime-core/src/warning.ts @@ -31,8 +31,6 @@ export function popWarningContext() { } export function warn(msg: string, ...args: any[]) { - if (!__DEV__ && !__FEATURE_PROD_HYDRATION_MISMATCH_DETAILS__) return - // avoid props formatting or warn handler tracking deps that might be mutated // during patch, leading to infinite recursion. pauseTracking()