Ad
Run A Custom Babel Transform With React-Native
I need to use babel-plugin-transform-decorators-legacy
with React-Native to enable @decorators. How does one configure React-Native / Babel to make this possible?
This is related to my previous question about how to get @decorators working in React-Native: https://stackoverflow.com/a/34271636/941058
Ad
Answer
Use official Babel presets
Install the official Babel presets for React Native applications:
npm i babel-preset-react-native --save-dev
Edit your .babelrc
:
{
"presets": ["react-native"]
}
Prior RN v21.0: Extend the original .babelrc from react-native
To avoid manipulating files in the node_modules
directory, you should extend the original .babelrc
.
By keeping your dependencies clean, there won't be any issues with upgrades or sharing the project.
{
"extends": "react-native/packager/react-packager/.babelrc",
}
Ad
source: stackoverflow.com
Related Questions
- → How to update data attribute on Ajax complete
- → October CMS - Radio Button Ajax Click Twice in a Row Causes Content to disappear
- → Octobercms Component Unique id (Twig & Javascript)
- → Passing a JS var from AJAX response to Twig
- → Laravel {!! Form::open() !!} doesn't work within AngularJS
- → DropzoneJS & Laravel - Output form validation errors
- → Import statement and Babel
- → Uncaught TypeError: Cannot read property '__SECRET_DOM_DO_NOT_USE_OR_YOU_WILL_BE_FIRED' of undefined
- → React-router: Passing props to children
- → ListView.DataSource looping data for React Native
- → Can't test submit handler in React component
- → React + Flux - How to avoid global variable
- → Webpack, React & Babel, not rendering DOM
Ad