fbjs icon indicating copy to clipboard operation
fbjs copied to clipboard

Use an argument to babel transform to determine environment

Open zpao opened this issue 8 years ago • 0 comments

With the current transforms we need to do different things when we're in __DEV__. The way I made that work was to piggyback on process.env.NODE_ENV as we've done for some other things. However that makes it so that you can't just run standalone jest in a project, instead you have a test script: "test": "NODE_ENV=test jest". That's fine as long as you don't care much about Windows or making people use npm test. But we should make this as seamless as possible for FB engineers so they can just run jest (assuming of course that they have run npm install -g jest-cli at some point in the past).

Another workaround is to just explicitly set process.env in the preprocessor, as was done in React (for now) - https://github.com/facebook/react/pull/5020

zpao avatar Oct 01 '15 01:10 zpao