-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathnext.config.js
40 lines (37 loc) · 939 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 withCSS = require('@zeit/next-css')
const withOffline = require("next-offline");
const nextConfig = {
target: "serverless",
dontAutoRegisterSw: true,
transformManifest: (manifest) => ["/"].concat(manifest),
generateInDevMode: true,
workboxOpts: {
swDest: "static/service-worker.js",
runtimeCaching: [
{
urlPattern: /\.(?:gif|ico|jpg|jpeg|png|svg|webp)(?:\?|$)/,
handler: "CacheFirst",
options: {
cacheName: "image-cache",
expiration: {
maxEntries: 500,
maxAgeSeconds: 60 * 60 * 24 * 7,
},
},
},
{
urlPattern: /api/,
handler: "NetworkFirst",
options: {
cacheableResponse: {
statuses: [0, 200],
headers: {
"x-test": "true",
},
},
},
},
],
},
};
module.exports = withCSS(withOffline(nextConfig));