Skip to content

Commit fce0884

Browse files
authored
fix(core): restore Rspack ProgressBar colors (#10632)
1 parent 5cf2c39 commit fce0884

File tree

2 files changed

+11
-8
lines changed

2 files changed

+11
-8
lines changed

packages/docusaurus-bundler/src/currentBundler.ts

+10-8
Original file line numberDiff line numberDiff line change
@@ -87,17 +87,19 @@ export async function getProgressBarPlugin({
8787
currentBundler: CurrentBundler;
8888
}): Promise<typeof WebpackBar> {
8989
if (currentBundler.name === 'rspack') {
90-
class CustomRspackProgressPlugin extends currentBundler.instance
91-
.ProgressPlugin {
92-
constructor({name}: {name: string}) {
93-
// TODO add support for color
94-
// Unfortunately the rspack.ProgressPlugin does not have a name option
90+
const rspack = getCurrentBundlerAsRspack({currentBundler});
91+
class CustomRspackProgressPlugin extends rspack.ProgressPlugin {
92+
constructor({name, color = 'green'}: {name?: string; color?: string}) {
93+
// Unfortunately rspack.ProgressPlugin does not have name/color options
9594
// See https://rspack.dev/plugins/webpack/progress-plugin
96-
// @ts-expect-error: adapt Rspack ProgressPlugin constructor
97-
super({prefix: name});
95+
super({
96+
prefix: name,
97+
template: `● {prefix:.bold} {bar:50.${color}/white.dim} ({percent}%) {wide_msg:.dim}`,
98+
progressChars: '■■',
99+
});
98100
}
99101
}
100-
return CustomRspackProgressPlugin as typeof WebpackBar;
102+
return CustomRspackProgressPlugin as unknown as typeof WebpackBar;
101103
}
102104

103105
return WebpackBar;

packages/docusaurus/src/webpack/client.ts

+1
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ async function createBaseClientConfig({
6565
new ChunkAssetPlugin(),
6666
new ProgressBarPlugin({
6767
name: 'Client',
68+
color: 'green',
6869
}),
6970
await createStaticDirectoriesCopyPlugin({
7071
props,

0 commit comments

Comments
 (0)