-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnext.config.js
More file actions
64 lines (60 loc) · 1.49 KB
/
next.config.js
File metadata and controls
64 lines (60 loc) · 1.49 KB
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
59
60
61
62
63
64
const path = require('path')
const webpack = require('webpack')
const ONE_YEAR_CACHE = 'public, max-age=31536000, immutable'
const nextPolyfillStub = path.join(
__dirname,
'src/lib/next-polyfill-module-stub.js'
)
/** @type {import('next').NextConfig} */
const nextConfig = {
outputFileTracingRoot: path.join(__dirname),
productionBrowserSourceMaps: true,
compress: true,
experimental: {
inlineCss: true,
},
webpack(config) {
config.plugins.push(
new webpack.NormalModuleReplacementPlugin(/polyfill-module$/, (resource) => {
if (
resource.context.includes(
path.join('node_modules', 'next', 'dist', 'client')
) ||
resource.context.includes(
path.join('node_modules', 'next', 'dist', 'esm', 'client')
)
) {
resource.request = nextPolyfillStub
}
})
)
return config
},
images: {
formats: ['image/avif', 'image/webp'],
qualities: [70, 75, 80],
remotePatterns: [
{
protocol: 'https',
hostname: '**.googleusercontent.com',
},
{
protocol: 'https',
hostname: 'avatars.githubusercontent.com',
},
],
},
async headers() {
return [
{
source: '/images/:path*',
headers: [{ key: 'Cache-Control', value: ONE_YEAR_CACHE }],
},
{
source: '/favicon.ico',
headers: [{ key: 'Cache-Control', value: ONE_YEAR_CACHE }],
},
]
},
}
module.exports = nextConfig