-
Notifications
You must be signed in to change notification settings - Fork 0
/
next.config.mjs
38 lines (32 loc) · 944 Bytes
/
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
// @ts-check
function getGraphQLEndpointUrl() {
const graphQLEndpoint = process.env.NEXT_PUBLIC_GRAPHQL_ENDPOINT;
if (!graphQLEndpoint) throw Error('graphQL endpoint is not defined');
return new URL(graphQLEndpoint);
}
const graphQLEndpointUrl = getGraphQLEndpointUrl();
/** @type {import('next').NextConfig} */
const config = {
distDir: 'dist',
reactStrictMode: true,
experimental: {
serverActions: true,
},
webpack(config) {
config.resolve.alias['@formatjs/icu-messageformat-parser'] =
'@formatjs/icu-messageformat-parser/no-parser';
return config;
},
images: {
remotePatterns: [
{
hostname: graphQLEndpointUrl.hostname,
protocol: (() => {
const protocol = graphQLEndpointUrl.protocol.slice(0, -1); // Remove trailing colon;
if (protocol === 'http' || protocol === 'https') return protocol;
})(),
},
],
},
};
export default config;