This commit is contained in:
parent
ac537df133
commit
14cd36579b
|
|
@ -1,11 +1,21 @@
|
||||||
|
/*
|
||||||
|
eslint-disable @next/next/no-sync-scripts
|
||||||
|
⛔ Please do not remove:
|
||||||
|
We are enforcing synchronous loading of /env.js here to inject window.RUNTIME_ENV
|
||||||
|
to ensure dynamic configurations like Supabase are available before React starts.
|
||||||
|
*/
|
||||||
import { Html, Head, Main, NextScript } from "next/document";
|
import { Html, Head, Main, NextScript } from "next/document";
|
||||||
|
import Script from "next/script";
|
||||||
|
|
||||||
export default function Document() {
|
export default function Document() {
|
||||||
return (
|
return (
|
||||||
<Html lang="en">
|
<Html lang="en">
|
||||||
<Head>
|
<Head>
|
||||||
{/* 使用 defer 确保 env.js 加载顺序 */}
|
{/* Use next/script to load env.js synchronously */}
|
||||||
<script src="/env.js" defer />
|
<Script
|
||||||
|
src="/env.js"
|
||||||
|
strategy="beforeInteractive" // Ensures the script loads before React starts
|
||||||
|
/>
|
||||||
</Head>
|
</Head>
|
||||||
<body>
|
<body>
|
||||||
<Main />
|
<Main />
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue