dify/web/next.config.ts
Joel db197bfc47 Merge branch 'main' into deploy/agent
# Conflicts:
#	api/controllers/console/auth/login.py
#	api/core/app/apps/agent_app/runtime_request_builder.py
#	api/core/workflow/nodes/agent_v2/runtime_request_builder.py
#	api/services/credit_pool_service.py
#	api/tests/unit_tests/controllers/console/auth/test_email_verification.py
#	web/__tests__/env.spec.ts
#	web/__tests__/proxy-frame-options.spec.ts
#	web/app/(commonLayout)/page.tsx
#	web/app/components/signin/__tests__/countdown.spec.tsx
#	web/app/signin/check-code/__tests__/page.spec.tsx
#	web/app/signin/components/__tests__/mail-and-code-auth.spec.tsx
#	web/app/signin/components/mail-and-code-auth.tsx
#	web/app/signin/components/turnstile.tsx
#	web/proxy.ts
2026-08-13 16:07:27 +08:00

60 lines
1.9 KiB
TypeScript

import type { NextConfig } from '@/next'
import createMDX from '@next/mdx'
import { codeInspectorPlugin } from 'code-inspector-plugin'
import { env } from './env'
const isDev = process.env.NODE_ENV === 'development'
const withMDX = createMDX()
const allowedDevOrigins = process.env.NEXT_ALLOWED_DEV_ORIGINS?.split(',')
.map((origin) => origin.trim())
.filter(Boolean)
const nextConfig: NextConfig = {
basePath: env.NEXT_PUBLIC_BASE_PATH,
cacheComponents: true,
...(allowedDevOrigins?.length ? { allowedDevOrigins } : {}),
transpilePackages: ['@t3-oss/env-core', '@t3-oss/env-nextjs', 'echarts', 'zrender'],
serverExternalPackages: ['loro-crdt'],
turbopack: {
rules: codeInspectorPlugin({
bundler: 'turbopack',
}),
},
experimental: {
instantInsights: {
validationLevel: 'manual-warning',
},
// TODO: Remove when the `typescript` package can point to TypeScript 7.
// Next.js resolves that package, while compiler-API consumers still require TypeScript 6.
useTypeScriptCli: false,
},
productionBrowserSourceMaps: false, // enable browser source map generation during the production build
// Configure pageExtensions to include md and mdx
pageExtensions: ['ts', 'tsx', 'js', 'jsx', 'md', 'mdx'],
typescript: {
// https://nextjs.org/docs/api-reference/next.config.js/ignoring-typescript-errors
ignoreBuildErrors: true,
},
async redirects() {
return [
{
source: '/explore/apps',
destination: '/',
permanent: true,
},
{
// TODO(2026-11-11): Remove after external education CTAs and active campaign links use the canonical route.
source: '/education-apply',
destination: '/education/apply',
permanent: true,
},
]
},
output: 'standalone',
compiler: {
removeConsole: isDev ? false : { exclude: ['warn', 'error'] },
},
}
export default withMDX(nextConfig)