Browse Source

🔧 Use webpackbar in antd-tools and bisheng

pull/13072/head
afc163 6 years ago
parent
commit
4647d46c22
No known key found for this signature in database GPG Key ID: 5F00908D72002306
  1. 1
      package.json
  2. 20
      site/bisheng.config.js
  3. 19
      webpack.config.js

1
package.json

@ -174,7 +174,6 @@
"typescript": "~3.1.1", "typescript": "~3.1.1",
"unified": "^7.0.0", "unified": "^7.0.0",
"values.js": "^1.0.3", "values.js": "^1.0.3",
"webpackbar": "^3.1.2",
"xhr-mock": "^2.4.1", "xhr-mock": "^2.4.1",
"xhr2": "^0.1.4" "xhr2": "^0.1.4"
}, },

20
site/bisheng.config.js

@ -1,8 +1,6 @@
const path = require('path'); const path = require('path');
const CSSSplitWebpackPlugin = require('css-split-webpack-plugin').default; const CSSSplitWebpackPlugin = require('css-split-webpack-plugin').default;
const replaceLib = require('antd-tools/lib/replaceLib'); const replaceLib = require('antd-tools/lib/replaceLib');
const webpack = require('webpack');
const WebpackBar = require('webpackbar');
const isDev = process.env.NODE_ENV === 'development'; const isDev = process.env.NODE_ENV === 'development';
const usePreact = process.env.REACT_ENV === 'preact'; const usePreact = process.env.REACT_ENV === 'preact';
@ -22,23 +20,6 @@ function alertBabelConfig(rules) {
}); });
} }
function usePrettyWebpackBar(config) {
// remove old progress plugin.
config.plugins = config.plugins
.filter((plugin) => {
return !(plugin instanceof webpack.ProgressPlugin)
&& !(plugin instanceof WebpackBar);
});
// use brand new progress bar.
config.plugins.push(
new WebpackBar({
name: '📦 Ant Design Site',
minimal: false,
})
);
}
module.exports = { module.exports = {
port: 8001, port: 8001,
source: { source: {
@ -131,7 +112,6 @@ module.exports = {
} }
alertBabelConfig(config.module.rules); alertBabelConfig(config.module.rules);
usePrettyWebpackBar(config);
config.plugins.push( config.plugins.push(
new CSSSplitWebpackPlugin({ size: 4000 }), new CSSSplitWebpackPlugin({ size: 4000 }),

19
webpack.config.js

@ -1,7 +1,6 @@
// This config is for building dist files // This config is for building dist files
const webpack = require('webpack'); const webpack = require('webpack');
const getWebpackConfig = require('antd-tools/lib/getWebpackConfig'); const getWebpackConfig = require('antd-tools/lib/getWebpackConfig');
const WebpackBar = require('webpackbar');
// noParse still leave `require('./locale' + name)` in dist files // noParse still leave `require('./locale' + name)` in dist files
// ignore is better // ignore is better
@ -29,30 +28,12 @@ function externalMoment(config) {
}; };
} }
function usePrettyWebpackBar(config) {
// remove old progress plugin.
config.plugins = config.plugins
.filter((plugin) => {
return !(plugin instanceof webpack.ProgressPlugin)
&& !(plugin instanceof WebpackBar);
});
// use brand new progress bar.
config.plugins.push(
new WebpackBar({
name: '📦 Webpack',
minimal: false,
})
);
}
const webpackConfig = getWebpackConfig(false); const webpackConfig = getWebpackConfig(false);
if (process.env.RUN_ENV === 'PRODUCTION') { if (process.env.RUN_ENV === 'PRODUCTION') {
webpackConfig.forEach((config) => { webpackConfig.forEach((config) => {
ignoreMomentLocale(config); ignoreMomentLocale(config);
externalMoment(config); externalMoment(config);
addLocales(config); addLocales(config);
usePrettyWebpackBar(config);
}); });
} }

Loading…
Cancel
Save