react的src配置成@

背景 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

上一篇:【问题解决】Script file ‘xxx‘ is not present. (conda环境)


下一篇:微信APP支付-java后台实现