-
Notifications
You must be signed in to change notification settings - Fork 4
/
next.config.js
68 lines (64 loc) · 1.49 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
/** @type string */
const ContentSecurityPolicy = `
default-src 'self';
script-src 'self';
child-src example.com;
style-src 'self' example.com;
font-src 'self';
`
const securityHeaders = [
{
key: 'Cross-Origin-Opener-Policy',
value: 'same-origin',
},
{
key: 'Cross-Origin-Embedder-Policy',
value: 'require-corp',
},
{
key: 'Access-Control-Allow-Origin',
value: '*',
},
]
/** @type {import('next').NextConfig} */
module.exports = {
reactStrictMode: process.env.NODE_ENV !== 'development',
async headers() {
return [
{
source: '/(.*)',
headers: securityHeaders,
},
]
},
webpack(config, { isServer, dev }) {
// Use the client static directory in the server bundle and prod mode
// Fixes `Error occurred prerendering page "/"`
config.output.webassemblyModuleFilename =
isServer && !dev
? '../static/wasm/[modulehash].wasm'
: 'static/wasm/[modulehash].wasm'
// Since Webpack 5 doesn't enable WebAssembly by default, we should do it manually
config.experiments = { ...config.experiments, asyncWebAssembly: true }
// Add SVG import support
config.module.rules.push({
test: /\.svg$/i,
issuer: /\.[jt]sx?$/,
use: ['@svgr/webpack'],
})
return config
},
i18n: {
defaultLocale: 'en',
locales: ['en'],
},
async redirects() {
return [
{
source: '/faerber',
destination: '/',
permanent: true,
},
]
},
}