Enable JSX source plugin in DEV and integrate it with React DevTools

Summary:
The `env` option has been broken in Babel for a while (https://github.com/babel/babel/issues/4539), and will be deprecated (https://github.com/babel/babel/issues/5276).

I am changing this code to the way Babel < 6.10 interpreted the `env` option. This should fix the `__source` JSX transform which was applied in DEV in the past, but stopped getting applied because of the Babel bug.

I also changed the `filename` passed by Babel to be relative (currently, to `fbsource` but open to other options). This way DEV builds are still reproducible.

This still needs some help from davidaurelio to make the root location more foolproof. I'd also appreciate zertosh taking a look in case there's a better way to "anchor" the relative path. All I need is to for `react-third-party/react-devtools/react-devtools` and `babelTransformer.js` to agree on what the relative path base is.

Closes https://github.com/facebook/react-native/pull/13893

Reviewed By: gaearon

Differential Revision: D5035892

Pulled By: davidaurelio

fbshipit-source-id: 19ffeb867d7ed5928e9de05dcec9ba85bf961dd5
This commit is contained in:
Dan Abramov
2017-05-12 08:43:02 -07:00
committed by Facebook Github Bot
parent 6e2c07534e
commit 7210a060e6
3 changed files with 12 additions and 8 deletions

View File

@@ -146,7 +146,7 @@
"babel-polyfill": "^6.20.0",
"babel-preset-es2015-node": "^6.1.1",
"babel-preset-fbjs": "^2.1.2",
"babel-preset-react-native": "^1.9.1",
"babel-preset-react-native": "^1.9.2",
"babel-register": "^6.24.1",
"babel-runtime": "^6.23.0",
"babel-traverse": "^6.24.1",