mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-01 03:08:17 +02:00
fix(core): restore Rspack ProgressBar colors (#10632)
This commit is contained in:
parent
5cf2c39836
commit
fce0884768
2 changed files with 11 additions and 8 deletions
|
@ -87,17 +87,19 @@ export async function getProgressBarPlugin({
|
||||||
currentBundler: CurrentBundler;
|
currentBundler: CurrentBundler;
|
||||||
}): Promise<typeof WebpackBar> {
|
}): Promise<typeof WebpackBar> {
|
||||||
if (currentBundler.name === 'rspack') {
|
if (currentBundler.name === 'rspack') {
|
||||||
class CustomRspackProgressPlugin extends currentBundler.instance
|
const rspack = getCurrentBundlerAsRspack({currentBundler});
|
||||||
.ProgressPlugin {
|
class CustomRspackProgressPlugin extends rspack.ProgressPlugin {
|
||||||
constructor({name}: {name: string}) {
|
constructor({name, color = 'green'}: {name?: string; color?: string}) {
|
||||||
// TODO add support for color
|
// Unfortunately rspack.ProgressPlugin does not have name/color options
|
||||||
// Unfortunately the rspack.ProgressPlugin does not have a name option
|
|
||||||
// See https://rspack.dev/plugins/webpack/progress-plugin
|
// See https://rspack.dev/plugins/webpack/progress-plugin
|
||||||
// @ts-expect-error: adapt Rspack ProgressPlugin constructor
|
super({
|
||||||
super({prefix: name});
|
prefix: name,
|
||||||
|
template: `● {prefix:.bold} {bar:50.${color}/white.dim} ({percent}%) {wide_msg:.dim}`,
|
||||||
|
progressChars: '■■',
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return CustomRspackProgressPlugin as typeof WebpackBar;
|
return CustomRspackProgressPlugin as unknown as typeof WebpackBar;
|
||||||
}
|
}
|
||||||
|
|
||||||
return WebpackBar;
|
return WebpackBar;
|
||||||
|
|
|
@ -65,6 +65,7 @@ async function createBaseClientConfig({
|
||||||
new ChunkAssetPlugin(),
|
new ChunkAssetPlugin(),
|
||||||
new ProgressBarPlugin({
|
new ProgressBarPlugin({
|
||||||
name: 'Client',
|
name: 'Client',
|
||||||
|
color: 'green',
|
||||||
}),
|
}),
|
||||||
await createStaticDirectoriesCopyPlugin({
|
await createStaticDirectoriesCopyPlugin({
|
||||||
props,
|
props,
|
||||||
|
|
Loading…
Add table
Reference in a new issue