背景 react的src配置成@
新建文件:config-overrides.js 放在根目录下
const { override } = require("customize-cra");
// import { override } from "customize-cra";
const path = require("path");
module.exports = override((config) => {
config.resolve.alias = {
"@": path.resolve(__dirname, "src"),
};
return config;
});
## 修改package.js文件内容
```js
//修改这部分内容
"scripts": {
"start": "react-app-rewired start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
启动报错解决办法
重新安装npm install react-app-rewired customize-cra --save
ok