-
Notifications
You must be signed in to change notification settings - Fork 0
/
next.config.js
40 lines (33 loc) · 920 Bytes
/
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
const withBundleAnalyzer = require('@next/bundle-analyzer')({
enabled: process.env.NODE_ENV === 'production' && !process.env.VERCEL,
})
const withImages = require('next-images')
module.exports = withImages(
withBundleAnalyzer({
images: {
deviceSizes: [375, 425, 640, 768],
},
poweredByHeader: false,
typescript: {
ignoreBuildErrors: true,
},
webpack(config, { dev }) {
const options = {
publicPath: '/_next/',
}
if (dev) {
options.name = 'static/[hash]'
} else {
config.optimization.moduleIds = 'total-size'
options.name = 'static/built-[1].[hash:6]'
options.regExp = '(\\w+).worker.(js|ts)$'
}
config.module.rules.push({
test: /\.worker\.(js|ts)$/,
use: { loader: 'workerize-loader', options },
})
config.output.globalObject = 'self'
return config
},
})
)