Skip to content

Instantly share code, notes, and snippets.

@dbrxnds
Created March 15, 2024 07:40
Show Gist options
  • Save dbrxnds/fcc94c7779932e21d53f5073c02ab7ab to your computer and use it in GitHub Desktop.
Save dbrxnds/fcc94c7779932e21d53f5073c02ab7ab to your computer and use it in GitHub Desktop.
const { withSentryConfig } = require("@sentry/nextjs")
const INTERNAL_PACKAGES = [
"@mrb/mysql",
"@mrb/utils",
"@mrb/serverless",
"@mrb/ui",
"@mrb/mailer",
"@mrb/form",
"@mrb/translations",
"@mrb/mongo",
"@mrb/elastic",
]
/**
* @type {import('next').NextConfig}
*/
const nextConfig = {
eslint: {
ignoreDuringBuilds: true,
},
typescript: {
ignoreBuildErrors: process.env.NEXT_PUBLIC_ORDERPICKER_ENV === "local",
},
reactStrictMode: false,
basePath: "/new",
images: {
remotePatterns: [
{
protocol: "https",
hostname: "[REDACTED]",
},
{
protocol: "https",
hostname: "[REDACTED]",
},
{
protocol: "https",
hostname: "[REDACTED]",
},
{
protocol: "https",
hostname: "[REDACTED]",
},
{
protocol: "https",
hostname: "[REDACTED]",
},
],
},
i18n: {
localeDetection: false,
defaultLocale: "en",
locales: ["nl", "de", "fr", "en", "pl", "es", "ja"],
},
sentry: {
widenClientFileUpload: true,
hideSourceMaps: true,
},
transpilePackages: INTERNAL_PACKAGES,
experimental: {
optimizePackageImports: INTERNAL_PACKAGES,
},
}
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, org, project, authToken, configFile, stripPrefix,
// urlPrefix, include, ignore
// eslint-disable-next-line turbo/no-undeclared-env-vars
environment: process.env.NEXT_PUBLIC_ORDERPICKER_ENV,
silent: true, // Suppresses all logs
// For all available options, see:
// https://github.com/getsentry/sentry-webpack-plugin#options.
authToken: "[REDACTED]",
}
// Make sure adding Sentry options is the last code to run before exporting, to
// ensure that your source maps include changes from all other Webpack plugins
module.exports = (phase, defaultConfig) => {
// This is for preview deploys
const isVercel = process.env.IS_VERCEL === "true"
if (process.env.NEXT_PUBLIC_ORDERPICKER_ENV === "local" || isVercel) {
delete nextConfig.sentry
return nextConfig
}
const sentryConfig = withSentryConfig(nextConfig, sentryWebpackPluginOptions)
return typeof sentryConfig === "function" ? sentryConfig(phase, defaultConfig) : sentryConfig
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment