【发布时间】:2019-04-12 03:08:44
【问题描述】:
我的理解是 react-app-rewired 不再适用于 create-react-app 的 v2。
看来你需要进入 babel(因此 react-app-rewired)。
【问题讨论】:
标签: create-react-app antd
我的理解是 react-app-rewired 不再适用于 create-react-app 的 v2。
看来你需要进入 babel(因此 react-app-rewired)。
【问题讨论】:
标签: create-react-app antd
您可以使用 craco 代替 react-app-rewired。
来自react-app-rewired issue comments的信息:
这里有一些示例 craco.config.js 配置文件:
Less
Ant Design + Less + modifyVars
Ant Design + Less + modifyVars + Preact
Preact有some more examples in the /recipes directory in the craco repo。
craco.config.js 的示例来自ndbroadbent:
const CracoAntDesignPlugin = require('craco-antd');
const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer');
const WebpackBar = require('webpackbar');
module.exports = {
webpack: {
alias: { react: 'preact-compat', 'react-dom': 'preact-compat' },
plugins: [
new BundleAnalyzerPlugin(),
new WebpackBar({ profile: true }),
],
},
plugins: [{ plugin: CracoAntDesignPlugin }],
};
【讨论】: