chore: do not use withSentryConfig for dev/e2e next config if not needed (#8629)

This fixes this error when executing particular e2e test with playwright
extension
<img width="347" alt="image"
src="https://github.com/user-attachments/assets/5f7608fc-7896-4014-b312-a0c36f21b7d1">
This commit is contained in:
Sasha
2024-10-10 16:10:11 +03:00
committed by GitHub
parent a70b193527
commit a3bf938862
2 changed files with 14 additions and 5 deletions

View File

@@ -1,5 +1,5 @@
export async function register() { export async function register() {
if (process.env.NEXT_RUNTIME === 'nodejs') { if (process.env.NEXT_RUNTIME === 'nodejs' && process.env.NEXT_PUBLIC_SENTRY_DSN) {
await import('./sentry.server.config.js') await import('./sentry.server.config.js')
} }
} }

View File

@@ -42,12 +42,21 @@ const config = withBundleAnalyzer(
'.mjs': ['.mts', '.mjs'], '.mjs': ['.mts', '.mjs'],
} }
// Ignore sentry warnings when not wrapped with withSentryConfig
webpackConfig.ignoreWarnings = [
...(webpackConfig.ignoreWarnings ?? []),
{ file: /esm\/platform\/node\/instrumentation.js/ },
{ module: /esm\/platform\/node\/instrumentation.js/ },
]
return webpackConfig return webpackConfig
}, },
}), }),
) )
export default withSentryConfig(config, { export default process.env.NEXT_PUBLIC_SENTRY_DSN
telemetry: false, ? withSentryConfig(config, {
tunnelRoute: '/monitoring-tunnel', telemetry: false,
}) tunnelRoute: '/monitoring-tunnel',
})
: config