-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
next.config.js
58 lines (54 loc) · 1.2 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
const nextPWA = require('next-pwa')
const nextConfig = {
headers() {
return [
{
headers: [
{
key: 'cache-control',
value: 'public,max-age=31536000,immutable'
}
],
source: '/workbox-:hash.js'
}
]
},
rewrites() {
return [
{
destination: '/_next/static/service-worker.js',
source: '/service-worker.js'
},
{
destination: '/_next/static/workbox-:hash.js',
source: '/workbox-:hash.js'
}
]
},
webpack(config, { defaultLoaders, dev }) {
config.module.rules.push({
test: /\.(?:mp3|ogg|vtt)$/i,
use: [
defaultLoaders.babel,
{
loader: 'url-loader',
options: {
limit: 2 * 1024,
name: dev
? '[name].[ext]?[contenthash:8]'
: '[name].[contenthash:8].[ext]',
outputPath: 'static/media',
publicPath: '/_next/static/media'
}
}
]
})
return config
}
}
const withPWA = nextPWA({
dest: '.next/static',
disable: process.env.NODE_ENV === 'development',
sw: 'service-worker.js'
})
module.exports = withPWA(nextConfig)