Create-react-app: Stop Treating warnings as errors because process.env.CI = true.

Created on 28 Dec 2017  路  6Comments  路  Source: facebook/create-react-app

Hello,

When running the react-scripts build on the CI, the build script does the following

Treating warnings as errors because process.env.CI = true.

This is due to this line of code.

I disagree with treating the CI differently during the build as it creates inconsistency between local environment and the CI. I pushed the code to github knowingly about the warnings, having the CI break from the warning I approved of pushing is rather unexpected to the user.

Most helpful comment

Hi! We've had a large discussion about this previously and decided that this is the best default behavior.

If you'd like to not use this behavior, simply set CI to false during your build command, e.g. CI=false npm run build.

All 6 comments

Hi! We've had a large discussion about this previously and decided that this is the best default behavior.

If you'd like to not use this behavior, simply set CI to false during your build command, e.g. CI=false npm run build.

hi @Timer! can you please provide a link to the discussion where it was decided to treat errors as warnings? Couldn't find it.

What about the other direction? What if I'd like to treat warnings as errors locally? Am I supposed to manually set the CI environment variable?

I'd prefer the default is to always treat warnings as errors, regardless of the environment, and give people some way to opt out if they think they know what they're doing (such as @Bamieh).

I am wondering what else is it using the env var CI ... if you set it to false beside the error/warning behavior is something else affected by this env var?

@mhermosi to my knowledge the test script is affected. If CI is false then it goes into a watch mode which is something you do not want on a CI-server.

So how do we opt out from "treat errors as warnings" while not using a watcher in the tests? Am I missing something?

I think this is weird implementation as well. There should be a way to keep process.env.CI = true but turn off warnings as errors.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

stopachka picture stopachka  路  3Comments

Aranir picture Aranir  路  3Comments

ap13p picture ap13p  路  3Comments

oltsa picture oltsa  路  3Comments

xgqfrms-GitHub picture xgqfrms-GitHub  路  3Comments