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 Script from "next/script";
|
||||
|
||||
export default function Document() {
|
||||
return (
|
||||
<Html lang="en">
|
||||
<Head>
|
||||
{/* 使用 defer 确保 env.js 加载顺序 */}
|
||||
<script src="/env.js" defer />
|
||||
{/* Use next/script to load env.js synchronously */}
|
||||
<Script
|
||||
src="/env.js"
|
||||
strategy="beforeInteractive" // Ensures the script loads before React starts
|
||||
/>
|
||||
</Head>
|
||||
<body>
|
||||
<Main />
|
||||
|
|
|
|||
Loading…
Reference in New Issue