/
next.config.js
43 lines (39 loc) · 1005 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
41
42
43
// @ts-check
/**@type {any} */
let config = {
poweredByHeader: false,
assetPrefix:
(process.env.NODE_ENV === 'production' && process.env.NEXT_PUBLIC_PATH_PREFIX) || '',
pageExtensions: ['page.tsx', 'api.ts'],
// reactStrictMode: true,
}
const withFonts = require('next-fonts')
config = withFonts(config)
const withOffline = require('next-offline')
/**@type {Partial<import('workbox-webpack-plugin').InjectManifestOptions>}*/
const workboxOpts = {
manifestTransforms: [
// @ts-ignore
manifest => {
manifest = manifest.map(u => {
u.url = u.url.replace('../public/', '')
return u
})
let home = {
url: '/',
revision: manifest
.filter(u => u.url.endsWith('pages/index.js'))[0]
.url.split('/')[3],
}
manifest = [home].concat(manifest)
return {
manifest: manifest,
}
},
],
}
// config = withOffline({
// ...config,
// workboxOpts: workboxOpts,
// })
module.exports = config