-
Notifications
You must be signed in to change notification settings - Fork 3
/
next.config.js
61 lines (56 loc) · 1.67 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
const { withSentryConfig } = require("@sentry/nextjs");
const GITHUB_CI = process.env.GITHUB_WORKFLOW;
const SKIP_SENTRY = process.env.SKIP_SENTRY;
const IS_PREVIEW = process.env.VERCEL_ENV === "preview";
let skipSentry = false;
if (SKIP_SENTRY === "1") {
skipSentry = true;
}
if (typeof GITHUB_CI === "string" && GITHUB_CI.length > 0) {
skipSentry = true;
}
if (IS_PREVIEW) {
skipSentry = true;
}
/***
* @type {import("next").NextConfig}
*/
const moduleExports = {
productionBrowserSourceMaps: true,
swcMinify: true,
async headers() {
return [
{
source: "/:path*",
headers: [
{
key: "Permissions-Policy",
value: "interest-cohort=()",
},
],
},
];
},
};
console.info("Is Sentry dry run mode?", skipSentry);
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
// For all available options, see:
// https://github.com/getsentry/sentry-webpack-plugin#options.
dryRun: skipSentry,
};
function withWrappedSentry(config) {
return withSentryConfig(config, SentryWebpackPluginOptions);
}
module.exports = () => {
const plugins = [];
if (!skipSentry) {
plugins.push(withWrappedSentry);
}
const config = plugins.reduce((acc, next) => next(acc), { ...moduleExports });
return config;
};