create-react-app — how to set EXTEND_ESLINT to true?

后端 未结 3 1508
Happy的楠姐
Happy的楠姐 2020-12-30 11:13

I have created a .env file in my project root but I\'m new to working with environments / variables and so I\'m unsure how to integrate the file so I can overri

3条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-30 12:08

    After struggling for hours, thanks to @Yuci my eslint is finally understanding my configurations.

    Instead of directly fixing the package file in node_modules/react-scripts/config/webpack.config.js, I have added npm scripts to always bust out the cache in start of npm run start and npm run build. This way you don't have to fear for 'accidentally' rebuilding the package in the future by rm -rf node_modules; npm install -- future me is not that clever.

    in packages.json, change the scripts entity like the following:

      "scripts": {
        "start": "npm run clear_cache:eslint && react-scripts start",
        "build": "npm run clear_cache:eslint && react-scripts build",
        "test": "react-scripts test",
        "eject": "react-scripts eject",
        "clear_cache:eslint": "rm -rf node_modules/.cache/eslint-loader"
      },
    

提交回复
热议问题