From cf3adb634a9b941b6a92252b24bb12fddd3a48d7 Mon Sep 17 00:00:00 2001 From: Arnaud Date: Fri, 30 Aug 2024 18:10:18 +0200 Subject: [PATCH] Use vite to detech production mode --- src/routes/__root.tsx | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/src/routes/__root.tsx b/src/routes/__root.tsx index 3b48f87..c9f3b8a 100644 --- a/src/routes/__root.tsx +++ b/src/routes/__root.tsx @@ -1,17 +1,16 @@ import { createRootRoute, Outlet } from "@tanstack/react-router"; import React from "react"; -const TanStackRouterDevtools = - process.env.NODE_ENV === "production" - ? () => null // Render nothing in production - : React.lazy(() => - // Lazy load in development - import("@tanstack/router-devtools").then((res) => ({ - default: res.TanStackRouterDevtools, - // For Embedded Mode - // default: res.TanStackRouterDevtoolsPanel - })) - ); +const TanStackRouterDevtools = import.meta.env.PROD + ? () => null // Render nothing in production + : React.lazy(() => + // Lazy load in development + import("@tanstack/router-devtools").then((res) => ({ + default: res.TanStackRouterDevtools, + // For Embedded Mode + // default: res.TanStackRouterDevtoolsPanel + })) + ); export const Route = createRootRoute({ component: () => {