mirror of
https://github.com/ant-design/ant-design.git
synced 2024-11-24 11:10:01 +08:00
site: Add replaceLib plugin to babel
This commit is contained in:
parent
ea338eb637
commit
143a7232e3
@ -1,9 +1,20 @@
|
||||
const path = require('path');
|
||||
const CSSSplitWebpackPlugin = require('css-split-webpack-plugin').default;
|
||||
const replaceLib = require('antd-tools/lib/replaceLib');
|
||||
|
||||
const isDev = process.env.NODE_ENV === 'development';
|
||||
const usePreact = process.env.REACT_ENV === 'preact';
|
||||
|
||||
function alertBabelConfig(rules) {
|
||||
rules.forEach((rule) => {
|
||||
if (rule.loader && rule.loader === 'babel-loader') {
|
||||
rule.options.plugins.push(replaceLib);
|
||||
} else if (rule.use) {
|
||||
alertBabelConfig(rule.use);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
port: 8001,
|
||||
source: {
|
||||
@ -80,6 +91,8 @@ module.exports = {
|
||||
config.devtool = 'source-map';
|
||||
}
|
||||
|
||||
alertBabelConfig(config.module.rules);
|
||||
|
||||
config.plugins.push(new CSSSplitWebpackPlugin({ size: 4000 }));
|
||||
|
||||
return config;
|
||||
|
Loading…
Reference in New Issue
Block a user