+
{/* */}
diff --git a/apps/blogai/components/dev-only/console-silencer.tsx b/apps/blogai/components/dev-only/console-silencer.tsx
new file mode 100644
index 0000000..a5d33cc
--- /dev/null
+++ b/apps/blogai/components/dev-only/console-silencer.tsx
@@ -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
+}
diff --git a/apps/blogai/next.config.js b/apps/blogai/next.config.js
index 0564b02..1196206 100644
--- a/apps/blogai/next.config.js
+++ b/apps/blogai/next.config.js
@@ -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: [
{