-
Notifications
You must be signed in to change notification settings - Fork 133
/
next.config.js
52 lines (50 loc) · 1.25 KB
/
next.config.js
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} */
// output mode: 'export' | 'standalone'
let output = 'standalone'
if (process.env.APP_ENV === 'tauri') {
output = 'export'
console.log('APP_ENV', process.env.APP_ENV)
}
const nextConfig = {
reactStrictMode: false,
output: output,
// distDir: 'dist', // 静态化
// trailingSlash: true,
transpilePackages: ['antd','ahooks'],
...(output !== 'export'
? {
rewrites() {
return {
fallback: [
{
source: '/api/:path*',
destination: `${process.env.NEXT_PUBLIC_API_URL || ''}/api/:path*`, // Proxy to Backend
},
],
}
},
}
: {}),
images: {
unoptimized: true,
remotePatterns: [
{
protocol: 'http',
hostname: '**',
},
],
dangerouslyAllowSVG: true,
contentDispositionType: 'attachment',
contentSecurityPolicy: "default-src 'self'; script-src 'none'; sandbox;",
},
webpack(config) {
config.module.rules.push({
test: /\.svg$/,
issuer: /\.[jt]sx?$/,
resourceQuery: { not: /url/ }, // exclude if *.svg?url
use: ['@svgr/webpack'],
}) // 针对 SVG 的处理规则
return config
},
}
module.exports = nextConfig