2023-04-06 07:26:56 +00:00
|
|
|
const { z } = require("zod");
|
2023-06-20 08:06:18 +00:00
|
|
|
const { withSentryConfig } = require("@sentry/nextjs");
|
2023-04-06 07:26:56 +00:00
|
|
|
|
|
|
|
const RequiredEnvs = z.object({
|
|
|
|
MAILCHIMP_CLIENT_ID: z.string().min(5),
|
|
|
|
MAILCHIMP_CLIENT_SECRET: z.string().min(5),
|
|
|
|
});
|
|
|
|
|
|
|
|
/** @type {import('next').NextConfig} */
|
2023-06-20 08:06:18 +00:00
|
|
|
const nextConfig = () => {
|
2023-04-06 07:26:56 +00:00
|
|
|
try {
|
|
|
|
RequiredEnvs.parse(process.env);
|
|
|
|
} catch (e) {
|
|
|
|
console.error("🚫 Missing required env variables, see message below");
|
|
|
|
console.error(e.issues);
|
|
|
|
process.exit(1);
|
|
|
|
}
|
|
|
|
|
|
|
|
return {
|
|
|
|
reactStrictMode: true,
|
|
|
|
transpilePackages: ["@saleor/apps-shared"],
|
|
|
|
};
|
|
|
|
};
|
2023-05-21 16:28:17 +00:00
|
|
|
|
2023-06-20 08:06:18 +00:00
|
|
|
const isSentryPropertiesInEnvironment =
|
|
|
|
process.env.SENTRY_AUTH_TOKEN && process.env.SENTRY_PROJECT && process.env.SENTRY_ORG;
|
2023-05-21 16:28:17 +00:00
|
|
|
|
2023-06-20 08:06:18 +00:00
|
|
|
const configWithSentry = withSentryConfig(
|
|
|
|
nextConfig,
|
2023-05-21 16:28:17 +00:00
|
|
|
{
|
|
|
|
silent: true,
|
|
|
|
org: process.env.SENTRY_ORG,
|
|
|
|
project: process.env.SENTRY_PROJECT,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
widenClientFileUpload: true,
|
|
|
|
transpileClientSDK: true,
|
|
|
|
tunnelRoute: "/monitoring",
|
|
|
|
hideSourceMaps: true,
|
|
|
|
disableLogger: true,
|
|
|
|
}
|
|
|
|
);
|
2023-06-20 08:06:18 +00:00
|
|
|
|
|
|
|
module.exports = isSentryPropertiesInEnvironment ? configWithSentry : nextConfig;
|