feat:修复编译错误,移除前端生产环境日志

This commit is contained in:
MatrixSeven
2025-08-08 16:31:10 +08:00
parent 550d051b9c
commit e606f4f030
2 changed files with 7 additions and 35 deletions

View File

@@ -1,5 +1,12 @@
/** @type {import('next').NextConfig} */
const nextConfig = {
// 编译器配置 - 在生产环境中去掉 console.log
compiler: {
removeConsole: process.env.NODE_ENV === 'production' ? {
exclude: ['error', 'warn', 'info'], // 保留 console.error, console.warn, console.info
} : false,
},
// 环境变量配置
env: {
GO_BACKEND_URL: process.env.GO_BACKEND_URL,

View File

@@ -1,35 +0,0 @@
"use client"
import {
Toast,
ToastClose,
ToastDescription,
ToastProvider,
ToastTitle,
ToastViewport,
} from "@/components/ui/toast"
import { useToast } from "@/hooks/use-toast"
export function Toaster() {
const { toasts } = useToast()
return (
<ToastProvider>
{toasts.map(function ({ id, title, description, action, ...props }) {
return (
<Toast key={id} {...props}>
<div className="grid gap-1">
{title && <ToastTitle>{title}</ToastTitle>}
{description && (
<ToastDescription>{description}</ToastDescription>
)}
</div>
{action}
<ToastClose />
</Toast>
)
})}
<ToastViewport />
</ToastProvider>
)
}