-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathnext.config.js
70 lines (66 loc) · 1.82 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
69
70
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
},
transpilePackages: ['three-stdlib'],
images: {
unoptimized: true,
remotePatterns: [
{
protocol: 'https',
hostname: 'api.qrserver.com',
port: '',
pathname: '*',
},
{
protocol: 'https',
hostname: 'qrserver.com',
port: '',
pathname: '*',
}
]
},
}
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
})
}
}