This commit is contained in:
parent
012e266a09
commit
a93f476e46
|
|
@ -19,6 +19,7 @@ import { dir } from 'i18next';
|
|||
import { ReactNode } from 'react';
|
||||
import TranslationsProvider from '@/components/TranslationsProvider';
|
||||
import initTranslations from '../i18n';
|
||||
import { ConsoleSilencer } from '@/components/dev-only/console-silencer'
|
||||
|
||||
export const runtime = 'edge' // 'nodejs' (default) | 'edge'
|
||||
|
||||
|
|
@ -68,7 +69,6 @@ export default async function RootLayout({
|
|||
children: ReactNode;
|
||||
params: { locale: string };
|
||||
}) {
|
||||
|
||||
const { t, resources } = await initTranslations(locale, i18nNamespaces);
|
||||
|
||||
return (
|
||||
|
|
@ -93,6 +93,7 @@ export default async function RootLayout({
|
|||
resources={resources}>
|
||||
<Toaster />
|
||||
<Providers attribute="class" defaultTheme="system" enableSystem>
|
||||
<ConsoleSilencer />
|
||||
<div className="flex min-h-screen flex-col">
|
||||
<main className="flex flex-1 flex-col bg-muted/0.3">
|
||||
{/* <Header /> */}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,17 @@
|
|||
'use client'
|
||||
|
||||
import { useEffect } from 'react'
|
||||
|
||||
export function ConsoleSilencer() {
|
||||
useEffect(() => {
|
||||
if (process.env.NODE_ENV === 'development') {
|
||||
console.log = () => {};
|
||||
console.debug = () => {};
|
||||
console.info = () => {};
|
||||
console.warn = () => {};
|
||||
console.error = () => {};
|
||||
}
|
||||
}, [])
|
||||
|
||||
return null
|
||||
}
|
||||
|
|
@ -17,8 +17,8 @@ const nextConfig = {
|
|||
esmExternals: "loose",
|
||||
},
|
||||
compiler: {
|
||||
removeConsole: false, // 保留所有模式中的 console.log
|
||||
//removeConsole: process.env.VERCEL_ENV === 'production' ? { exclude: ['error'] } : false,
|
||||
//removeConsole: false, // 保留所有模式中的 console.log
|
||||
removeConsole: process.env.NODE_ENV === 'production' ? { exclude: ['error'] } : false, // ✅ 用 NODE_ENV
|
||||
emotion: true,
|
||||
},
|
||||
webpack: (config, { isServer }) => {
|
||||
|
|
@ -52,9 +52,9 @@ const nextConfig = {
|
|||
// your project has ESLint errors.
|
||||
ignoreDuringBuilds: true,
|
||||
},
|
||||
experimental: {
|
||||
esmExternals: true,
|
||||
},
|
||||
// experimental: {
|
||||
// esmExternals: true,
|
||||
// },
|
||||
images: {
|
||||
remotePatterns: [
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue