├── .gitattributes ├── .editorconfig ├── index.js ├── .gitignore ├── .npmignore ├── LICENSE ├── package.json └── README.md /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto 2 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | # http://editorconfig.org 2 | root = true 3 | 4 | [*] 5 | indent_style = space 6 | indent_size = 4 7 | charset = utf-8 8 | trim_trailing_whitespace = true 9 | insert_final_newline = true 10 | 11 | [*.md] 12 | trim_trailing_whitespace = false 13 | -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | plugins: [ 3 | [ require('babel-plugin-react-transform').default, { 4 | transforms: [ { 5 | transform: require.resolve( 'react-transform-hmr' ), 6 | imports: [ 'react-native' ], 7 | locals: [ 'module' ] 8 | } ] 9 | } ] 10 | ] 11 | }; 12 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ### SublimeText ### 2 | *.sublime-workspace 3 | 4 | ### OSX ### 5 | .DS_Store 6 | .AppleDouble 7 | .LSOverride 8 | Icon 9 | 10 | # Thumbnails 11 | ._* 12 | 13 | # Files that might appear on external disk 14 | .Spotlight-V100 15 | .Trashes 16 | 17 | ### Windows ### 18 | # Windows image file caches 19 | Thumbs.db 20 | ehthumbs.db 21 | 22 | # Folder config file 23 | Desktop.ini 24 | 25 | # Recycle Bin used on file shares 26 | $RECYCLE.BIN/ 27 | 28 | ### App specific ### 29 | node_modules/ 30 | npm-debug.log 31 | .tmp 32 | -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | ### SublimeText ### 2 | *.sublime-workspace 3 | 4 | ### OSX ### 5 | .DS_Store 6 | .AppleDouble 7 | .LSOverride 8 | Icon 9 | 10 | # Thumbnails 11 | ._* 12 | 13 | # Files that might appear on external disk 14 | .Spotlight-V100 15 | .Trashes 16 | 17 | ### Windows ### 18 | # Windows image file caches 19 | Thumbs.db 20 | ehthumbs.db 21 | 22 | # Folder config file 23 | Desktop.ini 24 | 25 | # Recycle Bin used on file shares 26 | $RECYCLE.BIN/ 27 | 28 | ### App specific ### 29 | node_modules/ 30 | npm-debug.log 31 | .tmp 32 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 YADI Social 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "babel-preset-react-native-hmre", 3 | "description": "Babel preset for React Native HMR", 4 | "version": "1.0.0", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "repository": { 10 | "type": "git", 11 | "url": "git@github.com:yadi-social/babel-preset-react-native-hmre.git" 12 | }, 13 | "keywords": [ 14 | "babel", 15 | "react", 16 | "react-native", 17 | "react-transform-hmr" 18 | ], 19 | "author": "Dzmitry Khadorkin ", 20 | "license": "MIT", 21 | "bugs": "https://github.com/yadi-social/babel-preset-react-native-hmre/issues", 22 | "homepage": "https://github.com/yadi-social/babel-preset-react-native-hmre", 23 | "contributors": [ 24 | { 25 | "name": "Dzmitry Khadorkin", 26 | "email": "dzmitry@khadorkin.by" 27 | } 28 | ], 29 | "peerDependencies": { 30 | "react-native": "^0.15.0" 31 | }, 32 | "dependencies": { 33 | "babel-plugin-react-transform": "^2.0.0", 34 | "react-transform-hmr": "^1.0.1" 35 | }, 36 | "devDependencies": { 37 | "babel-cli": "^6.3.17", 38 | "babel-preset-react": "^6.3.13", 39 | "react-native": "^0.18.1" 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Babel preset for React Native HMR 2 | 3 | This preset will configure Babel 6 for 4 | [https://github.com/gaearon/react-transform-hmr](https://github.com/gaearon/react-transform-hmr) 5 | and React Native. 6 | 7 | It is recommended that this preset only be configured 8 | for your development builds. 9 | 10 | [![github home](https://img.shields.io/badge/YADI%20Social-babel--preset--react--native--hmre-green.svg?style=flat-square)](https://github.com/yadi-social/babel-preset-react-native-hmre) 11 | [![github issues](https://img.shields.io/github/issues/yadi-social/babel-preset-react-native-hmre.svg?style=flat-square)](https://github.com/yadi-social/babel-preset-react-native-hmre/issues) 12 | [![david-dm](https://img.shields.io/david/yadi-social/babel-preset-react-native-hmre.svg?style=flat-square)][npm-package] 13 | [![npm version](https://img.shields.io/npm/v/babel-preset-react-native-hmre.svg?style=flat-square)][npm-package] 14 | [![npm downloads](https://img.shields.io/npm/dm/babel-preset-react-native-hmre.svg?style=flat-square)][npm-package] 15 | [![npm license](https://img.shields.io/npm/l/babel-preset-react-native-hmre.svg?style=flat-square)][npm-package] 16 | 17 | - [Installation](#installation) 18 | - [Usage](#usage) 19 | - [License](#license) 20 | 21 | --- 22 | 23 | ## Installation 24 | 25 | `$ npm install babel-preset-react-native-hmre --save` 26 | 27 | ## Usage 28 | 29 | Configure babel via .babelrc 30 | 31 | ```json 32 | { 33 | "presets": [ "react", "es2015" ], 34 | "env": { 35 | "development": { 36 | "presets": [ "react-native-hmre" ] 37 | } 38 | } 39 | } 40 | ``` 41 | 42 | ## License 43 | 44 | [The MIT License](../master/LICENSE) 45 | 46 | [npm-package]: https://www.npmjs.com/package/babel-preset-react-native-hmre 47 | --------------------------------------------------------------------------------