mirror of
https://github.com/labring/FastGPT.git
synced 2026-05-10 01:08:08 +08:00
5ccdcc1cd4
* chore: bump pro submodule for hydration stability (#6808) * sandbox-sync-agent * refactor: host pro as submodule * chore: checkpoint host pro restructure * refactor workspace test layout and startup init * chore: update next turbopack setup * chore: snapshot current work before actions fix * chore: update pro submodule * chore: point pro submodule url to upstream https * fix: Dockerfile * chore: update pro submodule * ci: support private pro submodule token and skip fork jobs * fix(ci): build sdk workspace deps before code-sandbox bundle * fix(app): exclude vitest configs from production typecheck * fix(app-image): build sdk packages before next build * fix(ci): align dockerfiles with workspace sdk build flow * chore(docker): upgrade node20 docker images to node24 * fix(ci): read admin coverage output path in pro test workflow * fix(app-image): include next-i18next config and locale assets * chore: update pro submodule * chore: do not specify branch for submodule * chore: remove most ts-nocheck sign * chore: update pro submodule * chore: remove sandbox-agent-sync package * chore: do not modify "pushData" file logic * fix: health check * chore: restore dev axios proxy state * fix: test-fastgpt report workflow * fix: use valid vitest coverage action inputs * update shell (#6830) * .codex (#6832) * fix: home chat file uploads (#6838) * chore: update actions workflow yamls * chore: update turbo.json * fix: split admin preview image workflows * fix: allow home chat file uploads * chore: add skip file type check env (#6839) * chore: update actions workflow yamls (#6835) * chore: update actions workflow yamls * fix: allow pro workflows on fork pull requests * chore: update turbo.json * fix: split admin preview image workflows * chore: bump pro submodule for admin typecheck * chore: update pro submodule * chore: bump pro submodule for turbo ignore * chore: update pro submodule for file download api --------- Co-authored-by: Archer <545436317@qq.com>
108 lines
2.7 KiB
TypeScript
108 lines
2.7 KiB
TypeScript
import type { NextConfig } from 'next';
|
|
import path from 'path';
|
|
|
|
const basePath = process.env.NEXT_PUBLIC_BASE_URL || undefined;
|
|
|
|
const securityHeaders = [
|
|
{
|
|
key: 'X-Frame-Options',
|
|
value: 'DENY'
|
|
},
|
|
{
|
|
key: 'X-Content-Type-Options',
|
|
value: 'nosniff'
|
|
},
|
|
{
|
|
key: 'X-XSS-Protection',
|
|
value: '1; mode=block'
|
|
},
|
|
{
|
|
key: 'Referrer-Policy',
|
|
value: 'strict-origin-when-cross-origin'
|
|
},
|
|
{
|
|
key: 'Permissions-Policy',
|
|
value: 'geolocation=(self), microphone=(self), camera=(self)'
|
|
}
|
|
];
|
|
|
|
const optimizedPackageImports = [
|
|
'@chakra-ui/react',
|
|
'@chakra-ui/icons',
|
|
'lodash',
|
|
'framer-motion',
|
|
'@emotion/react',
|
|
'@emotion/styled'
|
|
];
|
|
|
|
const nextConfig: NextConfig = {
|
|
basePath,
|
|
i18n: {
|
|
defaultLocale: 'en',
|
|
locales: ['en', 'zh-CN', 'zh-Hant'],
|
|
localeDetection: false
|
|
},
|
|
output: 'standalone',
|
|
// Strict Mode is development-only; keep it disabled until double-render unsafe code is migrated.
|
|
reactStrictMode: false,
|
|
compress: true,
|
|
poweredByHeader: false,
|
|
productionBrowserSourceMaps: false,
|
|
async headers() {
|
|
return [
|
|
{
|
|
source: '/((?!chat/share$).*)',
|
|
headers: securityHeaders
|
|
}
|
|
];
|
|
},
|
|
turbopack: {
|
|
root: path.join(__dirname, '../../'),
|
|
rules: {
|
|
'*.svg': {
|
|
loaders: ['@svgr/webpack'],
|
|
as: '*.js'
|
|
}
|
|
}
|
|
},
|
|
transpilePackages: ['@modelcontextprotocol/sdk', 'ahooks'],
|
|
serverExternalPackages: [
|
|
'@node-rs/jieba',
|
|
'bullmq',
|
|
'@zilliz/milvus2-sdk-node',
|
|
'tiktoken',
|
|
'@opentelemetry/api-logs',
|
|
'@mariozechner/pi-agent-core',
|
|
'@mariozechner/pi-ai'
|
|
],
|
|
// 优化大库的 barrel exports tree-shaking
|
|
experimental: {
|
|
optimizePackageImports: optimizedPackageImports,
|
|
// 按页面拆分 CSS chunk,减少首屏 CSS 体积
|
|
cssChunking: 'strict',
|
|
// 减少内存占用
|
|
memoryBasedWorkersCount: true
|
|
},
|
|
outputFileTracingRoot: path.join(__dirname, '../../'),
|
|
// Exclude build-time-only packages from standalone output file tracing
|
|
outputFileTracingExcludes: {
|
|
'*': [
|
|
// Rspack bindings - only used in dev, not needed at runtime
|
|
'node_modules/@next/rspack-binding-*/**',
|
|
'node_modules/@rspack/binding-*/**',
|
|
'node_modules/next-rspack/**',
|
|
// GNU platform binaries - Alpine uses musl only
|
|
'node_modules/**/*-linux-x64-gnu*/**',
|
|
// typescript - build-time only
|
|
'node_modules/typescript/**',
|
|
// sharp libvips GNU variant (keep musl)
|
|
'node_modules/@img/sharp-libvips-linux-x64/**',
|
|
// bundle-analyzer - build-time only
|
|
'node_modules/@next/bundle-analyzer/**',
|
|
'node_modules/webpack-bundle-analyzer/**'
|
|
]
|
|
}
|
|
};
|
|
|
|
export default nextConfig;
|