After a deploy, an open tab still references the previous build's content-hashed chunks and the first lazy navigation dies with "Failed to fetch dynamically imported module". Handle Vite's vite:preloadError by reloading onto the current build, guarded to at most one reload per minute so a persistently missing chunk cannot reload-loop. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
11 lines
343 B
TypeScript
11 lines
343 B
TypeScript
import { createRoot } from "react-dom/client";
|
|
import App from "./App";
|
|
import { installPreloadErrorReload } from "./lib/reloadOnPreloadError";
|
|
import "./app.css";
|
|
|
|
installPreloadErrorReload();
|
|
|
|
const root = document.getElementById("root");
|
|
if (root === null) throw new Error("Root element #root not found");
|
|
createRoot(root).render(<App />);
|