Techdebt/improve sentry config (#5585)
* Fix console errors during build * Create source maps for productionpull/5544/head
parent
d8102615b1
commit
e2921c3126
|
@ -80,6 +80,7 @@ plugins.push(withAxiom);
|
||||||
/** @type {import("next").NextConfig} */
|
/** @type {import("next").NextConfig} */
|
||||||
const nextConfig = {
|
const nextConfig = {
|
||||||
i18n,
|
i18n,
|
||||||
|
productionBrowserSourceMaps: true,
|
||||||
/* We already do type check on GH actions */
|
/* We already do type check on GH actions */
|
||||||
typescript: {
|
typescript: {
|
||||||
ignoreBuildErrors: !!process.env.CI,
|
ignoreBuildErrors: !!process.env.CI,
|
||||||
|
@ -88,10 +89,8 @@ const nextConfig = {
|
||||||
eslint: {
|
eslint: {
|
||||||
ignoreDuringBuilds: !!process.env.CI,
|
ignoreDuringBuilds: !!process.env.CI,
|
||||||
},
|
},
|
||||||
experimental: {
|
images: {
|
||||||
images: {
|
unoptimized: true,
|
||||||
unoptimized: true,
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
webpack: (config) => {
|
webpack: (config) => {
|
||||||
config.plugins.push(
|
config.plugins.push(
|
||||||
|
@ -230,11 +229,6 @@ const nextConfig = {
|
||||||
|
|
||||||
return redirects;
|
return redirects;
|
||||||
},
|
},
|
||||||
sentry: {
|
|
||||||
hideSourceMaps: true,
|
|
||||||
// Prevents Sentry from running on this Edge function, where Sentry doesn't work yet (build whould crash the api route).
|
|
||||||
excludeServerRoutes: [/\/api\/social\/og\/image\/?/],
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const sentryWebpackPluginOptions = {
|
const sentryWebpackPluginOptions = {
|
||||||
|
@ -243,6 +237,14 @@ const sentryWebpackPluginOptions = {
|
||||||
|
|
||||||
const moduleExports = () => plugins.reduce((acc, next) => next(acc), nextConfig);
|
const moduleExports = () => plugins.reduce((acc, next) => next(acc), nextConfig);
|
||||||
|
|
||||||
|
if (process.env.NEXT_PUBLIC_SENTRY_DSN) {
|
||||||
|
nextConfig.sentry = {
|
||||||
|
hideSourceMaps: true,
|
||||||
|
// Prevents Sentry from running on this Edge function, where Sentry doesn't work yet (build whould crash the api route).
|
||||||
|
excludeServerRoutes: [/\/api\/social\/og\/image\/?/],
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
// Sentry should be the last thing to export to catch everything right
|
// Sentry should be the last thing to export to catch everything right
|
||||||
module.exports = process.env.NEXT_PUBLIC_SENTRY_DSN
|
module.exports = process.env.NEXT_PUBLIC_SENTRY_DSN
|
||||||
? withSentryConfig(moduleExports, sentryWebpackPluginOptions)
|
? withSentryConfig(moduleExports, sentryWebpackPluginOptions)
|
||||||
|
|
Loading…
Reference in New Issue