Use vite to detech production mode

This commit is contained in:
Arnaud 2024-08-30 18:10:18 +02:00
parent a9ec0c5156
commit cf3adb634a
No known key found for this signature in database
GPG Key ID: 69D6CE281FCAE663

View File

@ -1,17 +1,16 @@
import { createRootRoute, Outlet } from "@tanstack/react-router"; import { createRootRoute, Outlet } from "@tanstack/react-router";
import React from "react"; import React from "react";
const TanStackRouterDevtools = const TanStackRouterDevtools = import.meta.env.PROD
process.env.NODE_ENV === "production" ? () => null // Render nothing in production
? () => null // Render nothing in production : React.lazy(() =>
: React.lazy(() => // Lazy load in development
// Lazy load in development import("@tanstack/router-devtools").then((res) => ({
import("@tanstack/router-devtools").then((res) => ({ default: res.TanStackRouterDevtools,
default: res.TanStackRouterDevtools, // For Embedded Mode
// For Embedded Mode // default: res.TanStackRouterDevtoolsPanel
// default: res.TanStackRouterDevtoolsPanel }))
})) );
);
export const Route = createRootRoute({ export const Route = createRootRoute({
component: () => { component: () => {