forked from MoonTechLab/LunaTV
-
Notifications
You must be signed in to change notification settings - Fork 631
Expand file tree
/
Copy pathnext.config.js
More file actions
52 lines (45 loc) · 1.23 KB
/
next.config.js
File metadata and controls
52 lines (45 loc) · 1.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/** @type {import('next').NextConfig} */
const nextConfig = {
// 生产环境始终使用 standalone 模式(Vercel/Docker/Zeabur)
// 本地开发时(NODE_ENV !== 'production')不使用 standalone
...(process.env.NODE_ENV === 'production' ? { output: 'standalone' } : {}),
reactStrictMode: false,
// Puppeteer/Chromium 相关包不进行 bundle(用于 Vercel serverless)
serverExternalPackages: ['@sparticuz/chromium', 'puppeteer-core'],
// Next.js 16 使用 Turbopack,配置 SVG 加载
turbopack: {
root: __dirname,
rules: {
'*.svg': {
loaders: ['@svgr/webpack'],
as: '*.js',
},
},
},
// 性能优化:包体积优化和模块化导入
experimental: {
// 自动优化大型库的导入,只打包实际使用的部分
optimizePackageImports: [
'lucide-react',
'@heroicons/react',
'framer-motion',
'react-icons',
],
},
// 图片优化配置
images: {
// 禁用 Next.js 图片优化(代理图片不兼容)
unoptimized: true,
remotePatterns: [
{
protocol: 'https',
hostname: '**',
},
{
protocol: 'http',
hostname: '**',
},
],
},
};
module.exports = nextConfig;