Skip to content

Commit

Permalink
fix: Bundle names not being reset properly (#209)
Browse files Browse the repository at this point in the history
  • Loading branch information
nicholas-codecov authored Nov 18, 2024
1 parent c3546ff commit 9968698
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 6 deletions.
14 changes: 14 additions & 0 deletions .changeset/neat-jobs-train.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
"@codecov/nextjs-webpack-plugin": patch
"@codecov/bundler-plugin-core": patch
"@codecov/webpack-plugin": patch
"@codecov/rollup-plugin": patch
"@codecov/vite-plugin": patch
"@codecov/bundle-analyzer": patch
"@codecov/nuxt-plugin": patch
"@codecov/remix-vite-plugin": patch
"@codecov/solidstart-plugin": patch
"@codecov/sveltekit-plugin": patch
---

Fix issue with bundle names not being reset in nextjs, rollup, vite, and webpack plugins.
8 changes: 6 additions & 2 deletions packages/bundler-plugin-core/src/utils/Output.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class Output {
};
debug: boolean;
gitService?: ValidGitService;
originalBundleName: string;
#internalOriginalBundleName: string;
// uploader overrides
branch?: string;
build?: string;
Expand Down Expand Up @@ -65,7 +65,7 @@ class Output {
this.uploadToken = userOptions.uploadToken;
this.debug = userOptions.debug;
this.gitService = userOptions.gitService;
this.originalBundleName = userOptions.bundleName;
this.#internalOriginalBundleName = userOptions.bundleName;
this.oidc = userOptions.oidc;

if (userOptions.uploadOverrides) {
Expand Down Expand Up @@ -107,6 +107,10 @@ class Output {
return this.#internalBundleName;
}

get originalBundleName() {
return this.#internalOriginalBundleName;
}

setPlugin(pluginName: string, pluginVersion: string) {
if (!this.#internalLocks.pluginDetails) {
this.#internalPlugin = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export const nextJSWebpackBundleAnalysisPlugin: ExtendedBAUploadPlugin<{
stage: webpack.Compilation.PROCESS_ASSETS_STAGE_REPORT,
},
async () => {
output.setBundleName(output.bundleName);
output.setBundleName(output.originalBundleName);
// Webpack base chunk format options: https://webpack.js.org/configuration/output/#outputchunkformat
if (typeof compilation.outputOptions.chunkFormat === "string") {
if (compilation.name && compilation.name !== "") {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export const rollupBundleAnalysisPlugin: BundleAnalysisUploadPlugin = ({
return;
}

output.setBundleName(output.bundleName);
output.setBundleName(output.originalBundleName);
if (options.name && options.name !== "") {
output.setBundleName(`${output.bundleName}-${options.name}`);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export const viteBundleAnalysisPlugin: BundleAnalysisUploadPlugin = ({
return;
}

output.setBundleName(output.bundleName);
output.setBundleName(output.originalBundleName);
// add in bundle name if present
if (options.name && options.name !== "") {
output.setBundleName(`${output.bundleName}-${options.name}`);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export const webpackBundleAnalysisPlugin: BundleAnalysisUploadPlugin = ({
stage: webpack.Compilation.PROCESS_ASSETS_STAGE_REPORT,
},
async () => {
output.setBundleName(output.bundleName);
output.setBundleName(output.originalBundleName);
// Webpack base chunk format options: https://webpack.js.org/configuration/output/#outputchunkformat
if (typeof compilation.outputOptions.chunkFormat === "string") {
if (compilation.name && compilation.name !== "") {
Expand Down

0 comments on commit 9968698

Please sign in to comment.