-
Notifications
You must be signed in to change notification settings - Fork 0
/
next.config.mjs
73 lines (70 loc) · 1.69 KB
/
next.config.mjs
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
65
66
67
68
69
70
71
72
73
import path from 'path'
import bundleAnalyzer from '@next/bundle-analyzer'
import { fileURLToPath } from 'url'
const { ANALYZE, VERCEL_ENV, IGNORE_ERRORS } = process.env
const __filename = fileURLToPath(import.meta.url)
const __dirname = path.dirname(__filename)
const withBundleAnalyzer = bundleAnalyzer({
enabled: ANALYZE === 'true',
})
/** @type {import('next').NextConfig} */
const config = {
env: {
NEXT_PUBLIC_BUILD_DATE: new Date().toISOString(),
},
eslint: {
dirs: ['components', 'features', 'lib', 'pages', 'types'],
ignoreDuringBuilds: IGNORE_ERRORS ? true : false,
},
experimental: {
optimizeCss: true,
},
...(VERCEL_ENV === 'production' && {
compiler: {
removeConsole: {
exclude: ['error', 'warning', 'info'],
},
},
}),
images: {
imageSizes: [16, 32, 48, 64, 96, 128, 256, 384, 480],
},
sassOptions: {
includePaths: [path.join(__dirname), `${path.join(__dirname)}/stylesheets`],
silenceDeprecations: ['legacy-js-api'],
},
typescript: {
ignoreBuildErrors: IGNORE_ERRORS ? true : false,
},
webpack(config) {
config.module.rules.push({
test: /\.svg$/,
use: ['@svgr/webpack'],
})
return config
},
async headers() {
return [
{
source: '/(.*).(jpe?g|png|ico|webp|svg|xml|mp4|woff2?)',
locale: false,
headers: [
{
key: 'Cache-Control',
value: 'public, max-age=31536000, must-revalidate',
},
],
},
]
},
async redirects() {
return [
{
source: '/cv',
destination: '/Joonas-Sandell-CV.pdf',
permanent: false,
},
]
},
}
export default withBundleAnalyzer(config)