Fix fallback page error overlay (vercel/turbo#268)

This commit is contained in:
Alex Kirszenberg 2022-10-24 17:05:21 -07:00 committed by GitHub
parent dca015b121
commit c8067af03f

View file

@ -6,15 +6,23 @@ import {
initializeHMR,
ReactDevOverlay,
} from "@vercel/turbopack-next/dev/client";
import { onChunkUpdate } from "@vercel/turbopack-next/dev/hmr-client";
import { onUpdate } from "@vercel/turbopack-next/dev/hmr-client";
const pageChunkPath = location.pathname.slice(1);
onChunkUpdate(pageChunkPath, (update) => {
if (update.type === "restart") {
location.reload();
onUpdate(
{
path: pageChunkPath,
headers: {
accept: "text/html",
},
},
(update) => {
if (update.type === "restart") {
location.reload();
}
}
});
);
initializeHMR({
assetPrefix: "",