Skip to content

Commit fc1f540

Browse files
authored
feat(core): Don't add debugIdUploadPlugin when sourcemaps option is disabled (#753)
1 parent 26a4840 commit fc1f540

File tree

3 files changed

+45
-17
lines changed

3 files changed

+45
-17
lines changed

packages/bundler-plugin-core/src/index.ts

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -126,24 +126,24 @@ export function sentryUnpluginFactory({
126126

127127
if (!options.sourcemaps?.disable) {
128128
plugins.push(debugIdInjectionPlugin(logger));
129-
}
130129

131-
// This option is only strongly typed for the webpack plugin, where it is used. It has no effect on other plugins
132-
const webpack_forceExitOnBuildComplete =
133-
typeof options._experiments["forceExitOnBuildCompletion"] === "boolean"
134-
? options._experiments["forceExitOnBuildCompletion"]
135-
: undefined;
136-
137-
plugins.push(
138-
debugIdUploadPlugin(
139-
createDebugIdUploadFunction({
140-
sentryBuildPluginManager,
141-
}),
142-
logger,
143-
sentryBuildPluginManager.createDependencyOnBuildArtifacts,
144-
webpack_forceExitOnBuildComplete
145-
)
146-
);
130+
// This option is only strongly typed for the webpack plugin, where it is used. It has no effect on other plugins
131+
const webpack_forceExitOnBuildComplete =
132+
typeof options._experiments["forceExitOnBuildCompletion"] === "boolean"
133+
? options._experiments["forceExitOnBuildCompletion"]
134+
: undefined;
135+
136+
plugins.push(
137+
debugIdUploadPlugin(
138+
createDebugIdUploadFunction({
139+
sentryBuildPluginManager,
140+
}),
141+
logger,
142+
sentryBuildPluginManager.createDependencyOnBuildArtifacts,
143+
webpack_forceExitOnBuildComplete
144+
)
145+
);
146+
}
147147

148148
if (options.reactComponentAnnotation) {
149149
if (!options.reactComponentAnnotation.enabled) {
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import { sentryRollupPlugin } from "@sentry/rollup-plugin";
2+
3+
const debugIdUploadPluginName = "sentry-rollup-debug-id-upload-plugin";
4+
5+
test("should not call upload plugin when sourcemaps are disabled", () => {
6+
const plugins = sentryRollupPlugin({
7+
telemetry: false,
8+
sourcemaps: {
9+
disable: true,
10+
},
11+
}) as Array<{ name: string }>;
12+
13+
const debugIdUploadPlugin = plugins.find((plugin) => plugin.name === debugIdUploadPluginName);
14+
15+
expect(debugIdUploadPlugin).toBeUndefined();
16+
});
17+
18+
test("should call upload plugin when sourcemaps are enabled", () => {
19+
const plugins = sentryRollupPlugin({
20+
telemetry: false,
21+
}) as Array<{ name: string }>;
22+
23+
const debugIdUploadPlugin = plugins.find((plugin) => plugin.name === debugIdUploadPluginName);
24+
25+
expect(debugIdUploadPlugin).toBeDefined();
26+
});
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
// eslint-disable-next-line no-console
2+
console.log("Beep!");

0 commit comments

Comments
 (0)