Skip to content

Commit 92c10f3

Browse files
committed
fix(nextjs): Clean up sentry config wrapper from unused logic, fix build for experimental mode
1 parent 48f1a4f commit 92c10f3

File tree

1 file changed

+0
-60
lines changed

1 file changed

+0
-60
lines changed

packages/nextjs/src/config/withSentryConfig.ts

Lines changed: 0 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,6 @@ function getFinalConfigObject(
6767
}
6868
}
6969

70-
setUpBuildTimeVariables(incomingUserNextConfigObject, userSentryOptions, releaseName);
71-
7270
const nextJsVersion = getNextjsVersion();
7371

7472
// Add the `clientTraceMetadata` experimental option based on Next.js version. The option got introduced in Next.js version 15.0.0 (actually 14.3.0-canary.64).
@@ -287,64 +285,6 @@ function setUpTunnelRewriteRules(userNextConfig: NextConfigObject, tunnelPath: s
287285
};
288286
}
289287

290-
function setUpBuildTimeVariables(
291-
userNextConfig: NextConfigObject,
292-
userSentryOptions: SentryBuildOptions,
293-
releaseName: string | undefined,
294-
): void {
295-
const assetPrefix = userNextConfig.assetPrefix || userNextConfig.basePath || '';
296-
const basePath = userNextConfig.basePath ?? '';
297-
const rewritesTunnelPath =
298-
userSentryOptions.tunnelRoute !== undefined && userNextConfig.output !== 'export'
299-
? `${basePath}${userSentryOptions.tunnelRoute}`
300-
: undefined;
301-
302-
const buildTimeVariables: Record<string, string> = {
303-
// Make sure that if we have a windows path, the backslashes are interpreted as such (rather than as escape
304-
// characters)
305-
_sentryRewriteFramesDistDir: userNextConfig.distDir?.replace(/\\/g, '\\\\') || '.next',
306-
// Get the path part of `assetPrefix`, minus any trailing slash. (We use a placeholder for the origin if
307-
// `assetPrefix` doesn't include one. Since we only care about the path, it doesn't matter what it is.)
308-
_sentryRewriteFramesAssetPrefixPath: assetPrefix
309-
? new URL(assetPrefix, 'http://dogs.are.great').pathname.replace(/\/$/, '')
310-
: '',
311-
};
312-
313-
if (userNextConfig.assetPrefix) {
314-
buildTimeVariables._assetsPrefix = userNextConfig.assetPrefix;
315-
}
316-
317-
if (userSentryOptions._experimental?.thirdPartyOriginStackFrames) {
318-
buildTimeVariables._experimentalThirdPartyOriginStackFrames = 'true';
319-
}
320-
321-
if (rewritesTunnelPath) {
322-
buildTimeVariables._sentryRewritesTunnelPath = rewritesTunnelPath;
323-
}
324-
325-
if (basePath) {
326-
buildTimeVariables._sentryBasePath = basePath;
327-
}
328-
329-
if (userNextConfig.assetPrefix) {
330-
buildTimeVariables._sentryAssetPrefix = userNextConfig.assetPrefix;
331-
}
332-
333-
if (userSentryOptions._experimental?.thirdPartyOriginStackFrames) {
334-
buildTimeVariables._experimentalThirdPartyOriginStackFrames = 'true';
335-
}
336-
337-
if (releaseName) {
338-
buildTimeVariables._sentryRelease = releaseName;
339-
}
340-
341-
if (typeof userNextConfig.env === 'object') {
342-
userNextConfig.env = { ...buildTimeVariables, ...userNextConfig.env };
343-
} else if (userNextConfig.env === undefined) {
344-
userNextConfig.env = buildTimeVariables;
345-
}
346-
}
347-
348288
function getGitRevision(): string | undefined {
349289
let gitRevision: string | undefined;
350290
try {

0 commit comments

Comments
 (0)