Skip to content

Commit fc87791

Browse files
committed
fix: widenClientFileUpload should be a top-level
1 parent 9ef882c commit fc87791

File tree

5 files changed

+8
-29
lines changed

5 files changed

+8
-29
lines changed

packages/nextjs/src/config/getBuildPluginOptions.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,8 @@ export function getBuildPluginOptions({
241241
const normalizedDistDirAbsPath = normalizePathForGlob(distDirAbsPath);
242242

243243
const loggerPrefix = LOGGER_PREFIXES[buildTool];
244-
const widenClientFileUpload = sentryBuildOptions.webpack?.widenClientFileUpload ?? false;
244+
// widenClientFileUpload is used for both webpack and turbopack, so it's a top-level option
245+
const widenClientFileUpload = sentryBuildOptions.widenClientFileUpload ?? false;
245246
const deleteSourcemapsAfterUpload = sentryBuildOptions.sourcemaps?.deleteSourcemapsAfterUpload ?? false;
246247

247248
const sourcemapUploadAssets = createSourcemapUploadAssetPatterns(

packages/nextjs/src/config/types.ts

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -58,19 +58,6 @@ export type NextConfigObject = {
5858
};
5959

6060
export type SentryBuildWebpackOptions = {
61-
/**
62-
* Include Next.js-internal code and code from dependencies when uploading source maps.
63-
*
64-
* Note: Enabling this option can lead to longer build times.
65-
* Disabling this option will leave you without readable stacktraces for dependencies and Next.js-internal code.
66-
*
67-
* Defaults to `false`.
68-
*/
69-
// Enabling this option may upload a lot of source maps and since the sourcemap upload endpoint in Sentry is super
70-
// slow we don't enable it by default so that we don't opaquely increase build times for users.
71-
// TODO: Add an alias to this function called "uploadSourceMapsForDependencies"
72-
widenClientFileUpload?: boolean;
73-
7461
/**
7562
* Automatically instrument Next.js data fetching methods and Next.js API routes with error and performance monitoring.
7663
* Defaults to `true`.
@@ -492,7 +479,8 @@ export type SentryBuildOptions = {
492479
* Disabling this option will leave you without readable stacktraces for dependencies and Next.js-internal code.
493480
*
494481
* Defaults to `false`.
495-
* @deprecated Use `webpack.widenClientFileUpload` instead.
482+
*
483+
* This option applies to both webpack and turbopack builds.
496484
*/
497485
// Enabling this option may upload a lot of source maps and since the sourcemap upload endpoint in Sentry is super
498486
// slow we don't enable it by default so that we don't opaquely increase build times for users.

packages/nextjs/src/config/withSentryConfig.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -150,12 +150,6 @@ function migrateDeprecatedWebpackOptions(userSentryOptions: SentryBuildOptions):
150150
deprecatedMessage('excludeServerRoutes', 'webpack.excludeServerRoutes'),
151151
);
152152

153-
webpack.widenClientFileUpload = withDeprecatedFallback(
154-
webpack.widenClientFileUpload,
155-
userSentryOptions.widenClientFileUpload,
156-
deprecatedMessage('widenClientFileUpload', 'webpack.widenClientFileUpload'),
157-
);
158-
159153
webpack.unstable_sentryWebpackPluginOptions = withDeprecatedFallback(
160154
webpack.unstable_sentryWebpackPluginOptions,
161155
userSentryOptions.unstable_sentryWebpackPluginOptions,

packages/nextjs/test/config/getBuildPluginOptions.test.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,9 +129,7 @@ describe('getBuildPluginOptions', () => {
129129
const result = getBuildPluginOptions({
130130
sentryBuildOptions: {
131131
...baseSentryOptions,
132-
webpack: {
133-
widenClientFileUpload: true,
134-
},
132+
widenClientFileUpload: true, // top-level option
135133
},
136134
releaseName: mockReleaseName,
137135
distDirAbsPath: mockDistDirAbsPath,

packages/nextjs/test/config/withSentryConfig.test.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -387,12 +387,10 @@ describe('withSentryConfig', () => {
387387
expect.stringContaining('[@sentry/nextjs] DEPRECATION WARNING: disableLogger is deprecated'),
388388
);
389389
expect(consoleWarnSpy).toHaveBeenCalledWith(expect.stringContaining('Use webpack.treeshake.debugLogs instead'));
390-
expect(consoleWarnSpy).toHaveBeenCalledWith(
390+
// widenClientFileUpload is not deprecated as it's used for both webpack and turbopack
391+
expect(consoleWarnSpy).not.toHaveBeenCalledWith(
391392
expect.stringContaining('[@sentry/nextjs] DEPRECATION WARNING: widenClientFileUpload is deprecated'),
392393
);
393-
expect(consoleWarnSpy).toHaveBeenCalledWith(
394-
expect.stringContaining('Use webpack.widenClientFileUpload instead'),
395-
);
396394
});
397395

398396
it('does not warn when using new webpack path', () => {
@@ -403,8 +401,8 @@ describe('withSentryConfig', () => {
403401
treeshake: {
404402
debugLogs: true,
405403
},
406-
widenClientFileUpload: true,
407404
},
405+
widenClientFileUpload: true, // top-level option, not deprecated
408406
};
409407

410408
materializeFinalNextConfig(exportedNextConfig, undefined, sentryOptions);

0 commit comments

Comments
 (0)