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