Files
novalon-website/next.config.ts
T
张翔 df8043c0df feat: 添加E2E测试并优化Docker部署配置
- 新增Playwright E2E测试配置和测试脚本
- 优化Dockerfile和docker-compose.yml配置
- 新增novalon-nginx和novalon-website的docker-compose配置
- 优化contact页面和contact-section组件的代码结构
- 更新多个页面的SEO和元数据配置
- 添加备案图标资源
- 修复ESLint错误:转义引号、添加ESLint禁用注释、移除未使用变量

测试覆盖: 新增website-acceptance.spec.ts E2E测试
2026-03-27 12:39:30 +08:00

109 lines
2.6 KiB
TypeScript

import type { NextConfig } from "next";
const isDev = process.env.NODE_ENV === 'development';
const cdnDomain = process.env.CDN_DOMAIN || '';
const nextConfig: NextConfig = {
distDir: 'dist',
output: 'standalone',
assetPrefix: isDev ? undefined : cdnDomain,
images: {
remotePatterns: [
{
protocol: 'https',
hostname: '**',
},
],
formats: ['image/avif', 'image/webp'],
deviceSizes: [640, 750, 828, 1080, 1200, 1920, 2048, 3840],
imageSizes: [16, 32, 48, 64, 96, 128, 256, 384],
dangerouslyAllowSVG: true,
contentDispositionType: 'attachment',
contentSecurityPolicy: "default-src 'self'; script-src 'none'; sandbox;",
minimumCacheTTL: 60,
unoptimized: !isDev,
},
compress: true,
poweredByHeader: false,
reactStrictMode: true,
reactProductionProfiling: !isDev,
experimental: {
optimizePackageImports: ['lucide-react'],
},
compiler: {
removeConsole: process.env.NODE_ENV === 'production',
},
headers: async () => {
return [
{
source: '/:path*',
headers: [
{
key: 'X-DNS-Prefetch-Control',
value: 'on'
},
{
key: 'Strict-Transport-Security',
value: 'max-age=63072000; includeSubDomains; preload'
},
{
key: 'X-XSS-Protection',
value: '1; mode=block'
},
{
key: 'X-Frame-Options',
value: 'SAMEORIGIN'
},
{
key: 'X-Content-Type-Options',
value: 'nosniff'
},
{
key: 'Referrer-Policy',
value: 'origin-when-cross-origin'
},
{
key: 'Permissions-Policy',
value: 'camera=(), microphone=(), geolocation=()'
},
],
},
{
source: '/:all*(svg|jpg|jpeg|png|gif|webp|avif)',
locale: false,
headers: [
{
key: 'Cache-Control',
value: 'public, max-age=31536000, immutable',
},
],
},
{
source: '/_next/static/:all*',
locale: false,
headers: [
{
key: 'Cache-Control',
value: 'public, max-age=31536000, immutable',
},
],
},
{
source: '/fonts/:all*',
locale: false,
headers: [
{
key: 'Cache-Control',
value: 'public, max-age=31536000, immutable',
},
{
key: 'Access-Control-Allow-Origin',
value: '*',
},
],
},
];
},
};
export default nextConfig;