-
Notifications
You must be signed in to change notification settings - Fork 48
/
next.config.js
65 lines (59 loc) · 1.62 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
57
58
59
60
61
62
63
64
65
// eslint-disable-next-line @typescript-eslint/no-var-requires
const { i18n } = require('./next-i18next.config')
// eslint-disable-next-line @typescript-eslint/no-var-requires
require('dotenv').config()
// eslint-disable-next-line @typescript-eslint/no-var-requires, import/order
const withBundleAnalyzer = require('@next/bundle-analyzer')({
enabled: process.env.ANALYZE === 'true',
})
const datasetPaths = [
'utslappen',
'koldioxidbudgetarna',
'klimatplanerna',
'konsumtionen',
'elbilarna',
'laddarna',
'cyklarna',
'upphandlingarna',
]
/** @type {require('next').NextConfig} */
module.exports = withBundleAnalyzer({
webpack(config) {
config.module.rules.push({
test: /\.svg$/i,
issuer: /\.[jt]sx?$/,
use: ['@svgr/webpack'],
})
return config
},
reactStrictMode: true,
compiler: {
styledComponents: {
ssr: true,
displayName: true,
},
},
i18n,
// Redirects configuration
async redirects() {
// Use Vercel-defined base URL by default to get the correct base URL in preview deployments too.
const baseURL = process.env.NEXT_PUBLIC_BASE_URL ?? `https://${process.env.NEXT_PUBLIC_VERCEL_URL}`
return [
...datasetPaths.map((path) => ({
source: `/${path}/:slug*`,
destination: '/',
permanent: true,
})),
{
source: '/bolagsklimatkollen',
destination: `${baseURL}/2024-06-Bolagsklimatkollen.pdf`,
permanent: false,
},
{
source: '/corporateclimatechecker',
destination: `${baseURL}/2024-08_CorporateClimateChecker.pdf`,
permanent: false,
},
]
},
})