-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathnext.config.js
90 lines (86 loc) · 2.18 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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
const { withSentryConfig } = require("@sentry/nextjs");
const locales = (
process.env.NEXT_PUBLIC_LOCALES || process.env.PAYLOAD_PUBLIC_LOCALES
)
?.split(",")
?.map((l) => l.trim())
.filter(Boolean);
const defaultLocale =
(
process.env.NEXT_PUBLIC_DEFAULT_LOCALE ||
process.env.PAYLOAD_PUBLIC_DEFAULT_LOCALE
)?.trim() || locales?.[0];
const nextConfig = {
...(locales?.length
? {
i18n: {
locales,
defaultLocale,
},
}
: undefined),
images: {
domains: process.env.NEXT_PUBLIC_IMAGE_DOMAINS?.split(",")
?.map((d) => d.trim())
?.filter((d) => d),
unoptimized:
process.env.NEXT_PUBLIC_IMAGE_UNOPTIMIZED?.trim()?.toLowerCase() ===
"true",
},
modularizeImports: {
// NOTE: only transform @mui/material and not any of sub-modules e.g. @mui/material/styles.
"@mui/material^": {
transform: "@mui/material/{{member}}",
},
},
pageExtensions: ["page.js"],
reactStrictMode: true,
async redirects() {
return [
{
source: "/knowledge",
destination: "/knowledge/explainers",
permanent: true,
},
{
source: "/opportunities/events",
destination: "/opportunities#events",
permanent: true,
},
{
source: "/opportunities/grants-fellowships",
destination: "/opportunities#grants-fellowships",
permanent: true,
},
{
source: "/resources",
destination: "/resources/datasets",
permanent: true,
},
];
},
transpilePackages: ["@commons-ui/core", "@commons-ui/next"],
webpack: (config) => {
config.module.rules.push(
{
test: /\.svg$/i,
type: "asset",
resourceQuery: /url/, // *.svg?url
},
{
test: /\.svg$/i,
issuer: /\.[jt]sx?$/,
resourceQuery: { not: [/url/] }, // exclude react component if *.svg?url
use: ["@svgr/webpack"],
},
);
return config;
},
};
module.exports = withSentryConfig(nextConfig, {
silent: !process.env.CI,
hideSourceMaps: true,
org: process.env.SENTRY_ORG,
authToken: process.env.SENTRY_AUTH_TOKEN,
project: process.env.SENTRY_PROJECT,
});