Skip to content

Commit b86d945

Browse files
author
Luca Forstner
committed
feat(nextjs): Directly forward sourcemaps.disable to webpack plugin
1 parent 2dc9d87 commit b86d945

File tree

3 files changed

+4
-7
lines changed

3 files changed

+4
-7
lines changed

packages/nextjs/src/config/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ export type SentryBuildOptions = {
122122
*/
123123
sourcemaps?: {
124124
/**
125-
* Disable any functionality related to source maps upload.
125+
* Disable any functionality related to source maps.
126126
*/
127127
disable?: boolean;
128128

packages/nextjs/src/config/webpackPluginOptions.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,6 @@ export function getWebpackPluginOptions(
5151
);
5252
}
5353

54-
if (sentryBuildOptions.sourcemaps?.disable) {
55-
sourcemapUploadAssets = [];
56-
}
57-
5854
return {
5955
authToken: sentryBuildOptions.authToken,
6056
headers: sentryBuildOptions.headers,
@@ -69,6 +65,7 @@ export function getWebpackPluginOptions(
6965
silent: sentryBuildOptions.silent,
7066
url: sentryBuildOptions.sentryUrl,
7167
sourcemaps: {
68+
disable: sentryBuildOptions.sourcemaps?.disable,
7269
rewriteSources(source) {
7370
if (source.startsWith('webpack://_N_E/')) {
7471
return source.replace('webpack://_N_E/', '');

packages/nextjs/test/config/webpack/webpackPluginOptions.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,11 +173,11 @@ describe('getWebpackPluginOptions()', () => {
173173
});
174174
});
175175

176-
it('sets `sourcemaps.assets` to an empty array when `sourcemaps.disable` is true', () => {
176+
it('sets `sourcemaps.disable` plugin options to true when `sourcemaps.disable` is true', () => {
177177
const buildContext = generateBuildContext({ isServer: false });
178178
const generatedPluginOptions = getWebpackPluginOptions(buildContext, { sourcemaps: { disable: true } }, undefined);
179179
expect(generatedPluginOptions.sourcemaps).toMatchObject({
180-
assets: [],
180+
disable: true,
181181
});
182182
});
183183

0 commit comments

Comments
 (0)