Skip to content

Commit 298fb12

Browse files
authored
fix(core): Strip query strings from asset paths (#806)
* fix: Strip query strings from asset paths * PR review
1 parent 73787df commit 298fb12

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

packages/bundler-plugin-core/src/debug-id-upload.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { promisify } from "util";
66
import { SentryBuildPluginManager } from "./build-plugin-manager";
77
import { Logger } from "./logger";
88
import { ResolveSourceMapHook, RewriteSourcesHook } from "./types";
9+
import { stripQueryAndHashFromPath } from "./utils";
910

1011
interface DebugIdUploadPluginOptions {
1112
sentryBuildPluginManager: SentryBuildPluginManager;
@@ -15,7 +16,10 @@ export function createDebugIdUploadFunction({
1516
sentryBuildPluginManager,
1617
}: DebugIdUploadPluginOptions) {
1718
return async (buildArtifactPaths: string[]) => {
18-
await sentryBuildPluginManager.uploadSourcemaps(buildArtifactPaths);
19+
// Webpack and perhaps other bundlers allow you to append query strings to
20+
// filenames for cache busting purposes. We should strip these before upload.
21+
const cleanedPaths = buildArtifactPaths.map(stripQueryAndHashFromPath);
22+
await sentryBuildPluginManager.uploadSourcemaps(cleanedPaths);
1923
};
2024
}
2125

packages/integration-tests/utils/create-cjs-bundles.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ export function createCjsBundles(
7777
output: {
7878
path: path.join(outFolder, "webpack4"),
7979
libraryTarget: "commonjs",
80+
filename: "[name].js?[contenthash]",
8081
},
8182
target: "node", // needed for webpack 4 so we can access node api
8283
plugins: [sentryWebpackPlugin(sentryUnpluginOptions)],

0 commit comments

Comments
 (0)