Skip to content

Commit 9968698

Browse files
fix: Bundle names not being reset properly (#209)
1 parent c3546ff commit 9968698

File tree

6 files changed

+24
-6
lines changed

6 files changed

+24
-6
lines changed

.changeset/neat-jobs-train.md

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
"@codecov/nextjs-webpack-plugin": patch
3+
"@codecov/bundler-plugin-core": patch
4+
"@codecov/webpack-plugin": patch
5+
"@codecov/rollup-plugin": patch
6+
"@codecov/vite-plugin": patch
7+
"@codecov/bundle-analyzer": patch
8+
"@codecov/nuxt-plugin": patch
9+
"@codecov/remix-vite-plugin": patch
10+
"@codecov/solidstart-plugin": patch
11+
"@codecov/sveltekit-plugin": patch
12+
---
13+
14+
Fix issue with bundle names not being reset in nextjs, rollup, vite, and webpack plugins.

packages/bundler-plugin-core/src/utils/Output.ts

+6-2
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class Output {
2626
};
2727
debug: boolean;
2828
gitService?: ValidGitService;
29-
originalBundleName: string;
29+
#internalOriginalBundleName: string;
3030
// uploader overrides
3131
branch?: string;
3232
build?: string;
@@ -65,7 +65,7 @@ class Output {
6565
this.uploadToken = userOptions.uploadToken;
6666
this.debug = userOptions.debug;
6767
this.gitService = userOptions.gitService;
68-
this.originalBundleName = userOptions.bundleName;
68+
this.#internalOriginalBundleName = userOptions.bundleName;
6969
this.oidc = userOptions.oidc;
7070

7171
if (userOptions.uploadOverrides) {
@@ -107,6 +107,10 @@ class Output {
107107
return this.#internalBundleName;
108108
}
109109

110+
get originalBundleName() {
111+
return this.#internalOriginalBundleName;
112+
}
113+
110114
setPlugin(pluginName: string, pluginVersion: string) {
111115
if (!this.#internalLocks.pluginDetails) {
112116
this.#internalPlugin = {

packages/nextjs-webpack-plugin/src/nextjs-webpack-bundle-analysis/nextJSWebpackBundleAnalysisPlugin.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ export const nextJSWebpackBundleAnalysisPlugin: ExtendedBAUploadPlugin<{
4343
stage: webpack.Compilation.PROCESS_ASSETS_STAGE_REPORT,
4444
},
4545
async () => {
46-
output.setBundleName(output.bundleName);
46+
output.setBundleName(output.originalBundleName);
4747
// Webpack base chunk format options: https://webpack.js.org/configuration/output/#outputchunkformat
4848
if (typeof compilation.outputOptions.chunkFormat === "string") {
4949
if (compilation.name && compilation.name !== "") {

packages/rollup-plugin/src/rollup-bundle-analysis/rollupBundleAnalysisPlugin.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export const rollupBundleAnalysisPlugin: BundleAnalysisUploadPlugin = ({
3838
return;
3939
}
4040

41-
output.setBundleName(output.bundleName);
41+
output.setBundleName(output.originalBundleName);
4242
if (options.name && options.name !== "") {
4343
output.setBundleName(`${output.bundleName}-${options.name}`);
4444
}

packages/vite-plugin/src/vite-bundle-analysis/viteBundleAnalysisPlugin.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export const viteBundleAnalysisPlugin: BundleAnalysisUploadPlugin = ({
3838
return;
3939
}
4040

41-
output.setBundleName(output.bundleName);
41+
output.setBundleName(output.originalBundleName);
4242
// add in bundle name if present
4343
if (options.name && options.name !== "") {
4444
output.setBundleName(`${output.bundleName}-${options.name}`);

packages/webpack-plugin/src/webpack-bundle-analysis/webpackBundleAnalysisPlugin.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ export const webpackBundleAnalysisPlugin: BundleAnalysisUploadPlugin = ({
3636
stage: webpack.Compilation.PROCESS_ASSETS_STAGE_REPORT,
3737
},
3838
async () => {
39-
output.setBundleName(output.bundleName);
39+
output.setBundleName(output.originalBundleName);
4040
// Webpack base chunk format options: https://webpack.js.org/configuration/output/#outputchunkformat
4141
if (typeof compilation.outputOptions.chunkFormat === "string") {
4242
if (compilation.name && compilation.name !== "") {

0 commit comments

Comments
 (0)