我的理解是react-app-rewired在create-react-app的v2中不再起作用。
似乎您需要进入babel(因此,react-app-rewired)。
答案 0 :(得分:3)
您可以使用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。
来自ndbroadbent的craco.config.js
的示例:
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 }],
};