Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions packages/nextjs/src/config/withSentryConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,17 @@ export const DEFAULT_SERVER_EXTERNAL_PACKAGES = [
* @returns The modified config to be exported
*/
export function withSentryConfig<C>(nextConfig?: C, sentryBuildOptions: SentryBuildOptions = {}): C {
if (process.env.npm_lifecycle_event && !process.env.npm_lifecycle_event.includes('build')) {
if (sentryBuildOptions.debug) {
// eslint-disable-next-line no-console
console.debug(
'[@sentry/nextjs] Exiting withSentryConfig because of non-build npm_lifecycle_event detected:',
process.env.npm_lifecycle_event,
);
}
return nextConfig as C;
}

const castNextConfig = (nextConfig as NextConfig) || {};
if (typeof castNextConfig === 'function') {
return function (this: unknown, ...webpackConfigFunctionArgs: unknown[]): ReturnType<NextConfigFunction> {
Expand Down
Loading