This commit is contained in:
parent
48d56976b3
commit
582ca179d6
|
|
@ -125,10 +125,10 @@ export default async function RootLayout({
|
||||||
return (
|
return (
|
||||||
<html lang="en" suppressHydrationWarning>
|
<html lang="en" suppressHydrationWarning>
|
||||||
|
|
||||||
<head>
|
{/* <head>
|
||||||
{/* ✅ 注入客户端运行时环境变量 */}
|
{/* ✅ 注入客户端运行时环境变量 */}
|
||||||
<Script src="/env.js" strategy="beforeInteractive" />
|
<Script src="/env.js" strategy="beforeInteractive" />
|
||||||
</head>
|
</head> */}
|
||||||
|
|
||||||
<body className={inter.className}>
|
<body className={inter.className}>
|
||||||
<Providers attribute="class" defaultTheme="dark">
|
<Providers attribute="class" defaultTheme="dark">
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,17 @@
|
||||||
|
// pages/_document.tsx
|
||||||
|
import { Html, Head, Main, NextScript } from "next/document"
|
||||||
|
|
||||||
|
export default function Document() {
|
||||||
|
return (
|
||||||
|
<Html lang="en">
|
||||||
|
<Head>
|
||||||
|
{/* ✅ 阻塞加载 env.js,在 React 初始化前注入 window.RUNTIME_ENV */}
|
||||||
|
<script src="/env.js" />
|
||||||
|
</Head>
|
||||||
|
<body>
|
||||||
|
<Main />
|
||||||
|
<NextScript />
|
||||||
|
</body>
|
||||||
|
</Html>
|
||||||
|
)
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue