diff --git a/site/bisheng.config.js b/site/bisheng.config.js index 854eb067a5..6510c7d029 100644 --- a/site/bisheng.config.js +++ b/site/bisheng.config.js @@ -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;