create-react-app enviroment variables
process.env.NODE_ENV gives you either "development" or "production" or "test" When you run npm start it is equal to develpment When you run npm run build it is equal to production When you run npm test it is equal to test
Here is what the above code is Doing:
1. If the environment is development, enable source maps and add React Hot Loader
2. If the environment is production, minify the code
3. If the environment is test, use inline source maps instead of separate files (because Karma doesn’t support separate source maps)
4. Always add the babel-polyfill
5. Always compile the code with the same loaders