-
Notifications
You must be signed in to change notification settings - Fork 53
Expand file tree
/
Copy pathnext.config.mjs
More file actions
117 lines (107 loc) · 3.15 KB
/
next.config.mjs
File metadata and controls
117 lines (107 loc) · 3.15 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
// For "Build dependencies behind this expression are ignored and might cause incorrect cache invalidation." warning
// @see https://github.com/contentlayerdev/contentlayer/issues/129#issuecomment-1080416633
import './src/config/env.server.mjs'
/** @type {import('next').NextConfig} */
let config = {
logging: {
fetches: {
fullUrl: true,
},
},
// output: 'export',
reactStrictMode: true,
pageExtensions: ['ts', 'tsx', 'md', 'mdx'],
// runs on the root level
typescript: {
ignoreBuildErrors: false,
},
eslint: {
// note: handled by npm scripts which can specify --ext option to fiter out markdown files and let remark process them
ignoreDuringBuilds: true,
// ignoreDuringBuilds: false,
// dirs: ['src'],
// ignoreDuringBuilds: true,
// dirs: ['src', 'docs'],
},
experimental: {
// note: requires Next.js Canary https://nextjs.org/docs/messages/ppr-preview
// ppr: 'incremental',
serverComponentsHmrCache: true,
staleTimes: {
dynamic: 30,
static: 180,
},
// note: https://nextjs.org/blog/turbopack-for-development-stable#breaking-changes
turbo: {
rules: {
fs: {
// note: https://github.com/vercel/next.js/discussions/67196
// note: https://github.com/vercel/next.js/pull/64205 available only in canary?
browser: false,
},
tls: {
browser: false,
},
net: {
browser: false,
},
child_process: {
browser: false,
},
},
},
},
// note: fallback for non-Turbopack builds
webpack: (config, { isServer }) => {
if (!isServer) {
config.resolve.alias = {
...config.resolve.alias,
// note: https://stackoverflow.com/questions/72325544/react-component-cannot-read-properties-of-null-reading-usestate#comment127826083_72325544 for `yarn link @status-im/components
// react: path.resolve('./node_modules/react'),
}
// Google Spreadsheet API requires that webpack does not fallback with these node.js core modules, which are not available in the browser.
config.resolve.fallback.fs = false
config.resolve.fallback.tls = false
config.resolve.fallback.net = false
config.resolve.fallback.child_process = false
}
// note: https://github.com/contentlayerdev/contentlayer/issues/129#issuecomment-1080416633
// note: https://github.com/vercel/next.js/issues/33693
config.infrastructureLogging = {
level: 'error',
}
return config
},
transpilePackages: ['@status-im/wallet'],
async headers() {
return [
{
source: '/(.*)',
headers: [
{
key: 'Access-Control-Allow-Origin',
value: '*',
},
{
key: 'Access-Control-Allow-Methods',
value: 'GET, POST, OPTIONS',
},
{
key: 'Access-Control-Allow-Headers',
value: 'Content-Type, Authorization',
},
],
},
]
},
}
const plugins = []
export default () => {
for (const plugin of plugins) {
config = {
...config,
...plugin(config),
}
}
return config
}