Explorar o código

build: put ssrContext warning behind __DEV__ flag

Evan You %!s(int64=3) %!d(string=hai) anos
pai
achega
8dbf083133
Modificáronse 1 ficheiros con 5 adicións e 4 borrados
  1. 5 4
      packages/runtime-core/src/helpers/useSsrContext.ts

+ 5 - 4
packages/runtime-core/src/helpers/useSsrContext.ts

@@ -7,10 +7,11 @@ export const useSSRContext = <T = Record<string, any>>() => {
   if (!__GLOBAL__) {
     const ctx = inject<T>(ssrContextKey)
     if (!ctx) {
-      warn(
-        `Server rendering context not provided. Make sure to only call ` +
-          `useSSRContext() conditionally in the server build.`
-      )
+      __DEV__ &&
+        warn(
+          `Server rendering context not provided. Make sure to only call ` +
+            `useSSRContext() conditionally in the server build.`
+        )
     }
     return ctx
   } else if (__DEV__) {