소스 검색

refactor: adjust warn method treeshaking

Evan You 2 년 전
부모
커밋
73ae6adbb1
2개의 변경된 파일3개의 추가작업 그리고 3개의 파일을 삭제
  1. 3 1
      packages/runtime-core/src/index.ts
  2. 0 2
      packages/runtime-core/src/warning.ts

+ 3 - 1
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 {

+ 0 - 2
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()