Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion packages/nextjs/src/config/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ export type SentryBuildOptions = {
*/
sourcemaps?: {
/**
* Disable any functionality related to source maps upload.
* Disable any functionality related to source maps.
*/
disable?: boolean;

Expand Down
7 changes: 2 additions & 5 deletions packages/nextjs/src/config/webpackPluginOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export function getWebpackPluginOptions(
const distDir = (userNextConfig as NextConfigObject).distDir?.replace(/\\/g, '/') ?? '.next';
const distDirAbsPath = path.posix.join(projectDir, distDir);

let sourcemapUploadAssets: string[] = [];
const sourcemapUploadAssets: string[] = [];
const sourcemapUploadIgnore: string[] = [];

if (isServer) {
Expand Down Expand Up @@ -51,10 +51,6 @@ export function getWebpackPluginOptions(
);
}

if (sentryBuildOptions.sourcemaps?.disable) {
sourcemapUploadAssets = [];
}

return {
authToken: sentryBuildOptions.authToken,
headers: sentryBuildOptions.headers,
Expand All @@ -69,6 +65,7 @@ export function getWebpackPluginOptions(
silent: sentryBuildOptions.silent,
url: sentryBuildOptions.sentryUrl,
sourcemaps: {
disable: sentryBuildOptions.sourcemaps?.disable,
rewriteSources(source) {
if (source.startsWith('webpack://_N_E/')) {
return source.replace('webpack://_N_E/', '');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,11 +173,11 @@ describe('getWebpackPluginOptions()', () => {
});
});

it('sets `sourcemaps.assets` to an empty array when `sourcemaps.disable` is true', () => {
it('sets `sourcemaps.disable` plugin options to true when `sourcemaps.disable` is true', () => {
const buildContext = generateBuildContext({ isServer: false });
const generatedPluginOptions = getWebpackPluginOptions(buildContext, { sourcemaps: { disable: true } }, undefined);
expect(generatedPluginOptions.sourcemaps).toMatchObject({
assets: [],
disable: true,
});
});

Expand Down
Loading