forked from ubaidillah-saidah/blockchain-studio-indonesia
-
Notifications
You must be signed in to change notification settings - Fork 0
/
next.config.js
56 lines (49 loc) · 1.53 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
const { PHASE_DEVELOPMENT_SERVER } = require('next/constants')
const path = require('path')
const withOffline = require('next-offline')
// const nextOfflineConfig = {
// generateInDevMode: false,
// dontAutoRegisterSw: true,
// generateSw: false,
// workboxOpts: {
// swDest: 'static/service-worker.js',
// swSrc: path.join(__dirname, 'sw.js'),
// },
// }
module.exports = (phase) => {
if (phase === PHASE_DEVELOPMENT_SERVER) {
return {
/* Localhost on development for next/image component */
images: {
domains: ['localhost', 'res.cloudinary.com'],
},
}
}
return withOffline({
generateInDevMode: false,
dontAutoRegisterSw: true,
generateSw: false,
workboxOpts: {
swDest: 'static/service-worker.js',
swSrc: path.join(__dirname, 'sw.js'),
},
// I'm using cloudinary as a media provider, but you can use any other provider
// This are the strapi docs of how to set a different provider
// https://strapi.io/documentation/v3.x/plugins/upload.html#using-a-provider
// And a list of the available providers
// https://www.npmjs.com/search?q=strapi-provider-upload-
// Also, this are the docs of to change the provider on next.js
// https://nextjs.org/docs/basic-features/image-optimization#configuration
images: {
domains: ['res.cloudinary.com'],
},
async rewrites() {
return [
{
source: '/service-worker.js',
destination: '/_next/static/service-worker.js',
},
]
},
})
}