-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathnext.config.js
55 lines (51 loc) · 1.5 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
const runtimeCaching = require('next-pwa/cache')
const withPWA = require('next-pwa')({ dest: 'public', maximumFileSizeToCacheInBytes: 10000000, runtimeCaching })
const { PHASE_DEVELOPMENT_SERVER } = require('next/constants')
module.exports = (phase) => {
let baseConfig = {
reactStrictMode: true,
experimental: {
esmExternals: false
},
images: {
domains: ['api.qrserver.com', 'qrserver.com'],
},
}
if (phase === PHASE_DEVELOPMENT_SERVER) {
return {
...baseConfig,
webpack: (config, { isServer }) => {
if (!isServer) {
config.resolve.fallback.fs = false;
config.resolve.fallback.net = false;
config.resolve.fallback.tls = false;
config.resolve.fallback.dns = false;
config.resolve.fallback.child_process = false;
}
config.mode = 'development'
return config;
}
}
}
else {
return withPWA({
...baseConfig,
webpack: (config, { isServer }) => {
if (!isServer) {
config.resolve.fallback.fs = false;
config.resolve.fallback.net = false;
config.resolve.fallback.tls = false;
config.resolve.fallback.dns = false;
config.resolve.fallback.child_process = false;
}
config.mode = 'production'
return config;
},
experimental: {
esmExternals: false,
optimizeCss: true
},
poweredByHeader: false
})
}
}