Eslint错误

npm run eject使配置文件暴露此时,产生了错误
Using babel-preset-react-app requires that you specify NODE_ENV or BABEL_ENV environment variables. Valid values are “development”, “test”, and “production”. Instead, received: undefined.
image.png

eslintrc.json

添加.eslintrc.json,推荐使用此方法对eslint进行详细配置

  1. {
  2. "parserOptions": {
  3. "ecmaVersion": 7,
  4. "sourceType": "module",
  5. "babelOptions": {
  6. "presets": [
  7. ["babel-preset-react-app", false],
  8. "babel-preset-react-app/prod"
  9. ]
  10. }
  11. }
  12. }

Babel error immediately on eject https://github.com/facebook/create-react-app/issues/12070
parserOptions 解析器配置 & env 代码运行环境
https://blog.csdn.net/m0_52761633/article/details/123760575