Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 20s
Build & Deploy / 🧪 QA (push) Failing after 34s
Build & Deploy / 🏗️ Build (push) Has started running
Build & Deploy / 🚀 Deploy (push) Has been cancelled
Build & Deploy / 🧪 Smoke Test (push) Has been cancelled
Build & Deploy / ⚡ Lighthouse (push) Has been cancelled
Build & Deploy / 🔔 Notify (push) Has been cancelled
37 lines
1.3 KiB
Plaintext
37 lines
1.3 KiB
Plaintext
import { isThenable } from '@sentry/core';
|
|
import { getFinalConfigObject } from './getFinalConfigObject.js';
|
|
|
|
/**
|
|
* Wraps a user's Next.js config and applies Sentry build-time behavior (instrumentation + sourcemap upload).
|
|
*
|
|
* Supports both object and function Next.js configs.
|
|
*
|
|
* @param nextConfig - The user's exported Next.js config
|
|
* @param sentryBuildOptions - Options to configure Sentry's build-time behavior
|
|
* @returns The wrapped Next.js config (same shape as the input)
|
|
*/
|
|
function withSentryConfig(nextConfig, sentryBuildOptions = {}) {
|
|
const castNextConfig = (nextConfig ) || {};
|
|
if (typeof castNextConfig === 'function') {
|
|
return function ( ...webpackConfigFunctionArgs) {
|
|
const maybePromiseNextConfig = castNextConfig.apply(
|
|
this,
|
|
webpackConfigFunctionArgs,
|
|
);
|
|
|
|
if (isThenable(maybePromiseNextConfig)) {
|
|
return maybePromiseNextConfig.then(promiseResultNextConfig => {
|
|
return getFinalConfigObject(promiseResultNextConfig, sentryBuildOptions);
|
|
});
|
|
}
|
|
|
|
return getFinalConfigObject(maybePromiseNextConfig, sentryBuildOptions);
|
|
} ;
|
|
} else {
|
|
return getFinalConfigObject(castNextConfig, sentryBuildOptions) ;
|
|
}
|
|
}
|
|
|
|
export { withSentryConfig };
|
|
//# sourceMappingURL=index.js.map
|