-
Notifications
You must be signed in to change notification settings - Fork 89
/
next.config.js
72 lines (65 loc) · 1.72 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
import withBundleAnalyzer from "@next/bundle-analyzer";
import { withSentryConfig } from "@sentry/nextjs";
const bundleAnalyzer = withBundleAnalyzer({
enabled: process.env.ANALYZE === "true",
});
/**
* Run `build` or `dev` with `SKIP_ENV_VALIDATION` to skip env validation. This is especially useful
* for Docker builds.
*/
await import("./src/env.js");
/** @type {import("next").NextConfig} */
const nextConfig = {
output: process.env.DOCKER_OUTPUT ? "standalone" : undefined,
images: {
remotePatterns: [
{
hostname: "randomuser.me",
protocol: "https",
},
{
hostname: "avatars.githubusercontent.com",
protocol: "https",
},
],
},
webpack: (config, { isServer }) => {
/**
* Critical: prevents " ⨯ ./node_modules/canvas/build/Release/canvas.node
* Module parse failed: Unexpected character '�' (1:0)" error
*/
config.resolve.alias.canvas = false;
if (isServer) {
config.ignoreWarnings = [{ module: /opentelemetry/ }];
}
return config;
},
experimental: {
instrumentationHook: true,
serverComponentsExternalPackages: [
"pino",
"pino-pretty",
"pdf-lib",
"@aws-sdk/s3-request-presigner",
"@react-pdf/renderer",
],
},
eslint: {
ignoreDuringBuilds: true,
},
};
const hasSentry = !!(
process.env.SENTRY_ORG &&
process.env.SENTRY_PROJECT &&
process.env.NEXT_PUBLIC_SENTRY_DSN
);
export default hasSentry
? withSentryConfig(bundleAnalyzer(nextConfig), {
org: process.env.SENTRY_ORG,
project: process.env.SENTRY_PROJECT,
silent: true,
widenClientFileUpload: true,
hideSourceMaps: true,
disableLogger: true,
})
: bundleAnalyzer(nextConfig);