Last active
March 6, 2018 21:15
-
-
Save RobertFischer/316eafc0a194594315fb5e4752aaa11d to your computer and use it in GitHub Desktop.
Babel Configuration File for a Nicer Development Environment
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"presets": [ | |
"react-native" | |
], | |
"plugins": [ | |
"transform-strict-mode", | |
[ "auto-import", | |
{ "declarations": [ | |
{ "default": "React", "path": "react" }, | |
{ "default": "_", "path": "lodash" }, | |
{ "default": "Promise", "path": "bluebird" } | |
]} | |
], | |
"react-display-name" | |
], | |
"env": { | |
"development": { | |
"plugins": [ | |
"transform-react-jsx-self", | |
"transform-react-jsx-source" | |
] | |
}, | |
"production": { | |
"presets": [ | |
"minify" | |
], | |
"plugins": [ | |
"react-constant-elements", | |
"lodash" | |
] | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Here's everything this does.
React
, Lodash as_
, and Bluebird asPromise
.In development (eg: when
NODE_ENV
is unset or set to anything other than "production"), the following also happens:__self
to the React components, which React uses to improve error messaging.__source
to the React components, which contains line number and file name where the component was instantiated, so you can view/log those if you're curious.In production (eg: when
NODE_ENV="production"
), the following also happens: