-
-
Notifications
You must be signed in to change notification settings - Fork 15
/
next.config.js
61 lines (55 loc) · 2.04 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
// This file sets a custom webpack configuration to use your Next.js app
// with Sentry.
// https://nextjs.org/docs/api-reference/next.config.js/introduction
// https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/
// eslint-disable-next-line @typescript-eslint/no-var-requires
const { withSentryConfig } = require("@sentry/nextjs");
// This file was automatically added by edgio init.
// You should commit this file to source control.
// eslint-disable-next-line @typescript-eslint/no-var-requires
const withEdgio = require("@edgio/next/withEdgio");
/** @type {import('next').NextConfig} */
const nextConfig = {
reactStrictMode: true,
swcMinify: true,
images: {
// All the images are served from the CF CDN, so we don't need to optimize them.
// It optimized already optimized images resulting in shit quality.
unoptimized: true,
},
experimental: {
// 256 kB should be OK
largePageDataBytes: 256 * 1024,
},
// Localization completely changes the url and we would need to re-write the cache routes
// In future we can look into it
// i18n: {
// locales: ["en"],
// defaultLocale: "en",
// },
};
const withEdgioConfig = withEdgio({
...nextConfig,
});
const sentryWebpackPluginOptions = {
// Additional config options for the Sentry Webpack plugin. Keep in mind that
// the following options are set automatically, and overriding them is not
// recommended:
// release, url, authToken, configFile, stripPrefix,
// urlPrefix, include, ignore
silent: true, // Suppresses all logs
// For all available options, see:
// https://github.com/getsentry/sentry-webpack-plugin#options.
};
if (process.env.ANALYZE === "true") {
// eslint-disable-next-line @typescript-eslint/no-var-requires
const withBundleAnalyzer = require("@next/bundle-analyzer")({
enabled: process.env.ANALYZE === "true",
});
module.exports = withBundleAnalyzer(withEdgioConfig);
} else {
// Default config
module.exports = withSentryConfig(withEdgioConfig, sentryWebpackPluginOptions, {
hideSourcemaps: true,
});
}