]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
refactor: adjust warn method treeshaking
authorEvan You <yyx990803@gmail.com>
Tue, 26 Dec 2023 07:26:29 +0000 (15:26 +0800)
committerEvan You <yyx990803@gmail.com>
Tue, 26 Dec 2023 07:26:29 +0000 (15:26 +0800)
packages/runtime-core/src/index.ts
packages/runtime-core/src/warning.ts

index 232afba46f1367ba6683119ffad138de9c14738a..422d7e772a76124af7c568fb70eedbecb813f635 100644 (file)
@@ -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 {
index 67e4ee31255fdb62c3f12d9ba546530309081135..45284fc70c7b233bf0b0cd4a659007594c31d09c 100644 (file)
@@ -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()