disable sentry if next phase is PHASE_DEVELOPMENT_SERVER

This commit is contained in:
Abhinav 2022-01-09 13:52:57 +05:30
parent 4cdc93e345
commit 4b14427f36

View file

@ -4,6 +4,7 @@ const withBundleAnalyzer = require('@next/bundle-analyzer')({
const withWorkbox = require('@ente-io/next-with-workbox');
const { withSentryConfig } = require('@sentry/nextjs');
const { PHASE_DEVELOPMENT_SERVER } = require('next/constants');
const {
getGitSha,
@ -21,38 +22,39 @@ const GIT_SHA = getGitSha();
const IS_SENTRY_ENABLED = getIsSentryEnabled();
module.exports = withSentryConfig(
withWorkbox(
withBundleAnalyzer({
env: {
SENTRY_RELEASE: GIT_SHA,
},
workbox: WORKBOX_CONFIG,
module.exports = (phase) =>
withSentryConfig(
withWorkbox(
withBundleAnalyzer({
env: {
SENTRY_RELEASE: GIT_SHA,
},
workbox: WORKBOX_CONFIG,
headers() {
return [
{
// Apply these headers to all routes in your application....
source: ALL_ROUTES,
headers: convertToNextHeaderFormat({
...COOP_COEP_HEADERS,
...WEB_SECURITY_HEADERS,
...buildCSPHeader(CSP_DIRECTIVES),
}),
},
];
},
// https://dev.to/marcinwosinek/how-to-add-resolve-fallback-to-webpack-5-in-nextjs-10-i6j
webpack: (config, { isServer }) => {
if (!isServer) {
config.resolve.fallback.fs = false;
}
return config;
},
})
),
{
release: GIT_SHA,
dryRun: !IS_SENTRY_ENABLED,
}
);
headers() {
return [
{
// Apply these headers to all routes in your application....
source: ALL_ROUTES,
headers: convertToNextHeaderFormat({
...COOP_COEP_HEADERS,
...WEB_SECURITY_HEADERS,
...buildCSPHeader(CSP_DIRECTIVES),
}),
},
];
},
// https://dev.to/marcinwosinek/how-to-add-resolve-fallback-to-webpack-5-in-nextjs-10-i6j
webpack: (config, { isServer }) => {
if (!isServer) {
config.resolve.fallback.fs = false;
}
return config;
},
})
),
{
release: GIT_SHA,
dryRun: phase === PHASE_DEVELOPMENT_SERVER || !IS_SENTRY_ENABLED,
}
);