Skip to content

Commit d9b038b

Browse files
committed
fix: use native webpack progress plugin
1 parent 45fca97 commit d9b038b

2 files changed

Lines changed: 4 additions & 31 deletions

File tree

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,7 @@
9797
"unified": "^8.0.0",
9898
"url-loader": "^4.0.0",
9999
"webpack": "^5.0.0",
100-
"webpack-merge": "^4.2.1",
101-
"webpackbar": "^5.0.0"
100+
"webpack-merge": "^4.2.1"
102101
},
103102
"devDependencies": {
104103
"@rc-component/father-plugin": "^2.1.2",

src/getWebpackConfig.ts

Lines changed: 3 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { getProjectPath, resolve } from './utils/projectHelper';
22
import * as path from 'path';
33
import * as webpack from 'webpack';
4-
import WebpackBar from 'webpackbar';
54
import webpackMerge from 'webpack-merge';
65
import MiniCssExtractPlugin from 'mini-css-extract-plugin';
76
import CssMinimizerPlugin from 'css-minimizer-webpack-plugin';
@@ -35,33 +34,6 @@ interface GetWebpackConfigFunction {
3534
imageOptions: typeof imageOptions;
3635
}
3736

38-
const shouldFallbackToNativeProgressPlugin = () => {
39-
const [major = 0, minor = 0] = webpack.version
40-
.split('.')
41-
.map((version) => Number.parseInt(version, 10));
42-
43-
return major > 5 || (major === 5 && minor >= 106);
44-
};
45-
46-
class CompatibleProgressPlugin {
47-
private readonly plugin: { apply(compiler: webpack.Compiler): void };
48-
49-
constructor() {
50-
this.plugin = shouldFallbackToNativeProgressPlugin()
51-
? new webpack.ProgressPlugin({
52-
activeModules: true,
53-
})
54-
: new WebpackBar({
55-
name: '🚚 Ant Design Tools',
56-
color: '#2f54eb',
57-
});
58-
}
59-
60-
apply(compiler: webpack.Compiler) {
61-
this.plugin.apply(compiler);
62-
}
63-
}
64-
6537
const getWebpackConfig: GetWebpackConfigFunction = (modules, options = {}) => {
6638
const { enabledReactCompiler } = options;
6739

@@ -206,7 +178,9 @@ ${pkg.name} v${pkg.version}
206178
Copyright 2015-present, Alipay, Inc.
207179
All rights reserved.
208180
`),
209-
new CompatibleProgressPlugin(),
181+
new webpack.ProgressPlugin({
182+
activeModules: true,
183+
}),
210184
new CleanUpStatsPlugin(),
211185
],
212186

0 commit comments

Comments
 (0)