Skip to content

Commit 1cf484a

Browse files
committed
fix: Strip query strings from asset paths
1 parent 0cd9069 commit 1cf484a

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,10 @@ export function createDebugIdUploadFunction({
1515
sentryBuildPluginManager,
1616
}: DebugIdUploadPluginOptions) {
1717
return async (buildArtifactPaths: string[]) => {
18-
await sentryBuildPluginManager.uploadSourcemaps(buildArtifactPaths);
18+
// Webpack and perhaps other bundlers allow you to append query strings to
19+
// filenames for cache busting purposes. We should strip these before upload.
20+
const cleanedPaths = buildArtifactPaths.map((p) => p.split("?")[0] || p);
21+
await sentryBuildPluginManager.uploadSourcemaps(cleanedPaths);
1922
};
2023
}
2124

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)