{"_id":"react-transform-hmr","_rev":"260628","name":"react-transform-hmr","description":"A React Transform that enables hot reloading React classes using Hot Module Replacement API","dist-tags":{"latest":"1.0.4"},"maintainers":[{"name":"thejameskyle","email":"me@thejameskyle.com"}],"time":{"modified":"2021-06-03T16:44:28.000Z","created":"2015-09-19T14:55:50.417Z","1.0.4":"2016-03-06T18:03:51.127Z","1.0.3":"2016-03-06T03:16:09.046Z","1.0.2":"2016-02-02T17:18:50.133Z","1.0.1":"2015-09-25T20:13:43.901Z","1.0.0":"2015-09-19T16:41:46.683Z","0.1.6":"2015-09-19T15:33:04.533Z","0.1.5":"2015-09-19T14:55:50.417Z"},"users":{"panlw":true,"robertgonzales":true,"langri-sha":true,"nisimjoseph":true},"author":{"name":"Dan Abramov","email":"dan.abramov@me.com"},"repository":{"type":"git","url":"git+https://github.com/gaearon/react-transform-hmr.git"},"versions":{"1.0.4":{"name":"react-transform-hmr","version":"1.0.4","description":"A React Transform that enables hot reloading React classes using Hot Module Replacement API","main":"lib/index.js","files":["lib","src"],"repository":{"type":"git","url":"git+https://github.com/gaearon/react-transform-hmr.git"},"author":{"name":"Dan Abramov","email":"dan.abramov@me.com"},"license":"MIT","bugs":{"url":"https://github.com/gaearon/react-transform-hmr/issues"},"homepage":"https://github.com/gaearon/react-transform-hmr#readme","scripts":{"clean":"rimraf lib","build":"babel src --out-dir lib","prepublish":"npm run clean && npm run build"},"keywords":["react-transform","react","reactjs","webpack","hmr","live","edit","hot","reload","rhl","dx"],"dependencies":{"global":"^4.3.0","react-proxy":"^1.1.7"},"devDependencies":{"babel":"^5.8.23","rimraf":"^2.4.3"},"gitHead":"1ab7759a0b0700e71895dabc6a94e2f819455bd3","_id":"react-transform-hmr@1.0.4","_shasum":"e1a40bd0aaefc72e8dfd7a7cda09af85066397bb","_from":".","_npmVersion":"3.3.12","_nodeVersion":"5.3.0","_npmUser":{"name":"gaearon","email":"dan.abramov@gmail.com"},"dist":{"shasum":"e1a40bd0aaefc72e8dfd7a7cda09af85066397bb","size":4358,"noattachment":false,"key":"/react-transform-hmr/-/react-transform-hmr-1.0.4.tgz","tarball":"http://registry.cnpm.dingdandao.com/react-transform-hmr/download/react-transform-hmr-1.0.4.tgz"},"maintainers":[{"name":"thejameskyle","email":"me@thejameskyle.com"}],"_npmOperationalInternal":{"host":"packages-13-west.internal.npmjs.com","tmp":"tmp/react-transform-hmr-1.0.4.tgz_1457287427851_0.17050196835771203"},"directories":{},"publish_time":1457287431127,"_cnpm_publish_time":1457287431127,"_hasShrinkwrap":false},"1.0.3":{"name":"react-transform-hmr","version":"1.0.3","description":"A React Transform that enables hot reloading React classes using Hot Module Replacement API","main":"lib/index.js","files":["lib","src"],"repository":{"type":"git","url":"git+https://github.com/gaearon/react-transform-hmr.git"},"author":{"name":"Dan Abramov","email":"dan.abramov@me.com"},"license":"MIT","bugs":{"url":"https://github.com/gaearon/react-transform-hmr/issues"},"homepage":"https://github.com/gaearon/react-transform-hmr#readme","scripts":{"clean":"rimraf lib","build":"babel src --out-dir lib","prepublish":"npm run clean && npm run build"},"keywords":["react-transform","react","reactjs","webpack","hmr","live","edit","hot","reload","rhl","dx"],"dependencies":{"global":"^4.3.0","react-proxy":"^1.1.6"},"devDependencies":{"babel":"^5.8.23","rimraf":"^2.4.3"},"gitHead":"d866176b8da999f92985d42fbbc5c5db95e541a0","_id":"react-transform-hmr@1.0.3","_shasum":"aea0c45e5ce630645015d04dafa9d22533f409fb","_from":".","_npmVersion":"3.3.12","_nodeVersion":"5.3.0","_npmUser":{"name":"gaearon","email":"dan.abramov@gmail.com"},"dist":{"shasum":"aea0c45e5ce630645015d04dafa9d22533f409fb","size":4356,"noattachment":false,"key":"/react-transform-hmr/-/react-transform-hmr-1.0.3.tgz","tarball":"http://registry.cnpm.dingdandao.com/react-transform-hmr/download/react-transform-hmr-1.0.3.tgz"},"maintainers":[{"name":"thejameskyle","email":"me@thejameskyle.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/react-transform-hmr-1.0.3.tgz_1457234165751_0.7489461558870971"},"directories":{},"publish_time":1457234169046,"_cnpm_publish_time":1457234169046,"_hasShrinkwrap":false},"1.0.2":{"name":"react-transform-hmr","version":"1.0.2","description":"A React Transform that enables hot reloading React classes using Hot Module Replacement API","main":"lib/index.js","files":["lib","src"],"repository":{"type":"git","url":"git+https://github.com/gaearon/react-transform-hmr.git"},"author":{"name":"Dan Abramov","email":"dan.abramov@me.com"},"license":"MIT","bugs":{"url":"https://github.com/gaearon/react-transform-hmr/issues"},"homepage":"https://github.com/gaearon/react-transform-hmr#readme","scripts":{"clean":"rimraf lib","build":"babel src --out-dir lib","prepublish":"npm run clean && npm run build"},"keywords":["react-transform","react","reactjs","webpack","hmr","live","edit","hot","reload","rhl","dx"],"dependencies":{"global":"^4.3.0","react-proxy":"^1.1.1"},"devDependencies":{"babel":"^5.8.23","rimraf":"^2.4.3"},"gitHead":"d5beaefc8b557c0e0eafddbda5fc29797073abea","_id":"react-transform-hmr@1.0.2","_shasum":"b8aa721b8132d0ed72c96710c606cf3291dd2cf0","_from":".","_npmVersion":"3.7.0","_nodeVersion":"5.1.1","_npmUser":{"name":"gaearon","email":"dan.abramov@gmail.com"},"dist":{"shasum":"b8aa721b8132d0ed72c96710c606cf3291dd2cf0","size":4793,"noattachment":false,"key":"/react-transform-hmr/-/react-transform-hmr-1.0.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/react-transform-hmr/download/react-transform-hmr-1.0.2.tgz"},"maintainers":[{"name":"thejameskyle","email":"me@thejameskyle.com"}],"_npmOperationalInternal":{"host":"packages-9-west.internal.npmjs.com","tmp":"tmp/react-transform-hmr-1.0.2.tgz_1454433527657_0.7326932193245739"},"directories":{},"publish_time":1454433530133,"_cnpm_publish_time":1454433530133,"_hasShrinkwrap":false},"1.0.1":{"name":"react-transform-hmr","version":"1.0.1","description":"A React Transform that enables hot reloading React classes using Hot Module Replacement API","main":"lib/index.js","repository":{"type":"git","url":"git+https://github.com/gaearon/react-transform-hmr.git"},"author":{"name":"Dan Abramov","email":"dan.abramov@me.com"},"license":"MIT","bugs":{"url":"https://github.com/gaearon/react-transform-hmr/issues"},"homepage":"https://github.com/gaearon/react-transform-hmr#readme","scripts":{"clean":"rimraf lib","build":"babel src --out-dir lib","prepublish":"npm run clean && npm run build"},"keywords":["react-transform","react","reactjs","webpack","hmr","live","edit","hot","reload","rhl","dx"],"dependencies":{"global":"^4.3.0","react-proxy":"^1.1.1"},"devDependencies":{"babel":"^5.8.23","rimraf":"^2.4.3"},"gitHead":"ee98f8d9dc13a243c945eb63f7bdce3b3a372ef3","_id":"react-transform-hmr@1.0.1","_shasum":"59c353e9a486cae5fe31789b41d32b99dde1642d","_from":".","_npmVersion":"3.3.3","_nodeVersion":"2.2.1","_npmUser":{"name":"gaearon","email":"dan.abramov@gmail.com"},"dist":{"shasum":"59c353e9a486cae5fe31789b41d32b99dde1642d","size":4532,"noattachment":false,"key":"/react-transform-hmr/-/react-transform-hmr-1.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/react-transform-hmr/download/react-transform-hmr-1.0.1.tgz"},"maintainers":[{"name":"thejameskyle","email":"me@thejameskyle.com"}],"directories":{},"publish_time":1443212023901,"_cnpm_publish_time":1443212023901,"_hasShrinkwrap":false},"1.0.0":{"name":"react-transform-hmr","version":"1.0.0","description":"A React Transform that enables hot reloading React classes using Hot Module Replacement API","main":"lib/index.js","repository":{"type":"git","url":"git+https://github.com/gaearon/react-transform-hmr.git"},"author":{"name":"Dan Abramov","email":"dan.abramov@me.com"},"license":"MIT","bugs":{"url":"https://github.com/gaearon/react-transform-hmr/issues"},"homepage":"https://github.com/gaearon/react-transform-hmr#readme","scripts":{"clean":"rimraf lib","build":"babel src --out-dir lib","prepublish":"npm run clean && npm run build"},"keywords":["react-transform","react","reactjs","webpack","hmr","live","edit","hot","reload","rhl","dx"],"dependencies":{"global":"^4.3.0","react-proxy":"^1.1.0"},"devDependencies":{"babel":"^5.8.23","rimraf":"^2.4.3"},"gitHead":"158060b37eefbf3cb8d75efe2296c4ee394c4e6d","_id":"react-transform-hmr@1.0.0","_shasum":"154d8c1f8d591a8a335a6435802777dde62db33c","_from":".","_npmVersion":"2.11.0","_nodeVersion":"2.2.1","_npmUser":{"name":"gaearon","email":"dan.abramov@gmail.com"},"dist":{"shasum":"154d8c1f8d591a8a335a6435802777dde62db33c","size":3626,"noattachment":false,"key":"/react-transform-hmr/-/react-transform-hmr-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/react-transform-hmr/download/react-transform-hmr-1.0.0.tgz"},"maintainers":[{"name":"thejameskyle","email":"me@thejameskyle.com"}],"directories":{},"publish_time":1442680906683,"_cnpm_publish_time":1442680906683,"_hasShrinkwrap":false},"0.1.6":{"name":"react-transform-hmr","version":"0.1.6","description":"A React Transform that enables hot reloading React classes using Hot Module Replacement API","main":"lib/index.js","repository":{"type":"git","url":"git+https://github.com/gaearon/react-transform-hmr.git"},"author":{"name":"Dan Abramov","email":"dan.abramov@me.com"},"license":"MIT","bugs":{"url":"https://github.com/gaearon/react-transform-hmr/issues"},"homepage":"https://github.com/gaearon/react-transform-hmr#readme","scripts":{"clean":"rimraf lib","build":"babel src --out-dir lib","prepublish":"npm run clean && npm run build"},"keywords":["react-transform","react","reactjs","webpack","hmr","live","edit","hot","reload","rhl","dx"],"dependencies":{"global":"^4.3.0","react-proxy":"^1.1.0"},"devDependencies":{"babel":"^5.8.23","rimraf":"^2.4.3"},"gitHead":"2217c5edfcfb4676917567468c0d519298653043","_id":"react-transform-hmr@0.1.6","_shasum":"4d84949d70da8f874dd11ac85c618f20d022bc15","_from":".","_npmVersion":"2.11.0","_nodeVersion":"2.2.1","_npmUser":{"name":"gaearon","email":"dan.abramov@gmail.com"},"dist":{"shasum":"4d84949d70da8f874dd11ac85c618f20d022bc15","size":3549,"noattachment":false,"key":"/react-transform-hmr/-/react-transform-hmr-0.1.6.tgz","tarball":"http://registry.cnpm.dingdandao.com/react-transform-hmr/download/react-transform-hmr-0.1.6.tgz"},"maintainers":[{"name":"thejameskyle","email":"me@thejameskyle.com"}],"directories":{},"publish_time":1442676784533,"_cnpm_publish_time":1442676784533,"_hasShrinkwrap":false},"0.1.5":{"name":"react-transform-hmr","version":"0.1.5","description":"A React Transform that enables hot reloading React classes using Hot Module Replacement API","main":"lib/index.js","repository":{"type":"git","url":"git+https://github.com/gaearon/react-transform-hmr.git"},"author":{"name":"Dan Abramov","email":"dan.abramov@me.com"},"license":"MIT","bugs":{"url":"https://github.com/gaearon/react-transform-hmr/issues"},"homepage":"https://github.com/gaearon/react-transform-hmr#readme","scripts":{"clean":"rimraf lib","build":"babel src --out-dir lib","prepublish":"npm run clean && npm run build"},"keywords":["react-transform","react","reactjs","webpack","hmr","live","edit","hot","reload","rhl","dx"],"dependencies":{"global":"^4.3.0","react-proxy":"^1.1.0"},"devDependencies":{"babel":"^5.8.23","rimraf":"^2.4.3"},"gitHead":"7ea9b0ac30621e84d26c49c866f124f30fa87598","_id":"react-transform-hmr@0.1.5","_shasum":"a189294ea755f1f7446ad15d6f27e6d911b5a599","_from":".","_npmVersion":"2.11.0","_nodeVersion":"2.2.1","_npmUser":{"name":"gaearon","email":"dan.abramov@gmail.com"},"dist":{"shasum":"a189294ea755f1f7446ad15d6f27e6d911b5a599","size":3539,"noattachment":false,"key":"/react-transform-hmr/-/react-transform-hmr-0.1.5.tgz","tarball":"http://registry.cnpm.dingdandao.com/react-transform-hmr/download/react-transform-hmr-0.1.5.tgz"},"maintainers":[{"name":"thejameskyle","email":"me@thejameskyle.com"}],"directories":{},"publish_time":1442674550417,"_cnpm_publish_time":1442674550417,"_hasShrinkwrap":false}},"readme":"# react-transform-hmr\n\n[![react-transform channel on discord](https://img.shields.io/badge/discord-react--transform%40reactiflux-61DAFB.svg?style=flat-square)](http://www.reactiflux.com)\n\n\nA [React Transform](https://github.com/gaearon/babel-plugin-react-transform) that enables hot reloading React classes using Hot Module Replacement API. Hot module replacement is [supported natively by Webpack](http://webpack.github.io/docs/hot-module-replacement-with-webpack.html) and available in Browserify with [browserify-hmr](https://github.com/AgentME/browserify-hmr).\n\n## ????????????????????\n\nThis is **highly experimental tech**. If you’re enthusiastic about hot reloading, by all means, give it a try, but don’t bet your project on it. Either of the technologies it relies upon may change drastically or get deprecated any day. You’ve been warned ???? .\n\n**This technology exists to prototype next-generation React developer experience**. Please don’t use it blindly if you don’t know the underlying technologies well. Otherwise you are likely to get disillusioned with JavaScript tooling.\n\n**No effort went into making this user-friendly yet. The goal is to eventually kill this technology** in favor of less hacky technologies baked into React. These projects are not long term.\n\n## Installation\n\nFirst, install the [Babel plugin](https://github.com/gaearon/babel-plugin-react-transform):\n\n```\nnpm install --save-dev babel-plugin-react-transform\n```\n\nThen, install the transform:\n\n```\nnpm install --save-dev react-transform-hmr\n```\n\n### React\n\nEdit your `.babelrc` to include a plugin configuration for `react-transform`. It contains array of the transforms you want to use:\n\n```js\n{\n  \"presets\": [\"es2015\", \"stage-0\"],\n  \"env\": {\n    // only enable it when process.env.NODE_ENV is 'development' or undefined\n    \"development\": {\n      \"plugins\": [[\"react-transform\", {\n        \"transforms\": [{\n          \"transform\": \"react-transform-hmr\",\n          // if you use React Native, pass \"react-native\" instead:\n          \"imports\": [\"react\"],\n          // this is important for Webpack HMR:\n          \"locals\": [\"module\"]\n        }]\n        // note: you can put more transforms into array\n        // this is just one of them!\n      }]]\n    }\n  }\n}\n```\n\nMake sure you process files with `babel-loader`, and that you *don’t* use React Hot Loader (it’s not needed with this transform).\n\n**It is up to you to ensure that the transform is not enabled when you compile the app in production mode.** The easiest way to do this is to put React Transform configuration inside `env.development` in `.babelrc` and ensure you’re calling `babel` with `NODE_ENV=production`. See [babelrc documentation](https://babeljs.io/docs/usage/babelrc/#env-option) for more details about using `env` option.\n\n**Warning!** This doesn't currently work for stateless functional components that were introduced in [React 0.14](https://facebook.github.io/react/blog/2015/10/07/react-v0.14.html#stateless-functional-components)!\n\n### React Native\n\nThis transform enables hot reloading when used together with [React Native Webpack Server](https://github.com/mjohnston/react-native-webpack-server). **However note that you should not use `.babelrc` to configure it with React Native.** Otherwise you’ll get [`Uncaught SyntaxError: Unexpected reserved word` in `ActivityIndicatorIOS.ios.js`](https://github.com/mjohnston/react-native-webpack-server/issues/57#issuecomment-141487449).\n\nThere are two problems why `.babelrc` doesn’t work well in React Native:\n\n* Changes in it [aren’t picked up by packager’s aggressive caching](https://github.com/mjohnston/react-native-webpack-server/issues/63).\n* Another unknown problem causes `import` generated by `babel-plugin-react-transform` to not be compiled into a `require` call.\n\nUntil we have better `.babelrc` support in React Native, **you should configure React Transform together with `babel-loader`**:\n\n```js\nvar fs = require('fs');\nvar path = require('path');\nvar webpack = require('webpack');\n\nvar config = {\n  debug: true,\n\n  devtool: 'source-map',\n\n  entry: {\n    'index.ios': ['./src/main.js'],\n  },\n\n  output: {\n    path: path.resolve(__dirname, 'build'),\n    filename: '[name].js',\n  },\n\n  module: {\n    loaders: [{\n      test: /\\.js$/,\n      exclude: /node_modules/,\n      loader: 'babel',\n      query: {\n        stage: 0,\n        plugins: []\n      }\n    }]\n  },\n\n  plugins: []\n};\n\n// Hot mode\nif (process.env.HOT) {\n  config.devtool = 'eval';\n  config.entry['index.ios'].unshift('react-native-webpack-server/hot/entry');\n  config.entry['index.ios'].unshift('webpack/hot/only-dev-server');\n  config.entry['index.ios'].unshift('webpack-dev-server/client?http://localhost:8082');\n  config.output.publicPath = 'http://localhost:8082/';\n  config.plugins.unshift(new webpack.HotModuleReplacementPlugin());\n\n  // Note: enabling React Transform and React Transform HMR:\n  config.module.loaders[0].query.plugins.push([\n    'react-transform', {\n      transforms: [{\n        transform : 'react-transform-hmr',\n        imports   : ['react'],\n        locals    : ['module']\n      }]\n    }\n  ]);\n}\n\nif (process.env.NODE_ENV === 'production') {\n  config.plugins.push(new webpack.optimize.OccurrenceOrderPlugin());\n  config.plugins.push(new webpack.optimize.UglifyJsPlugin());\n}\n\nmodule.exports = config;\n```\n\nSee [React Native Webpack Server examples](https://github.com/mjohnston/react-native-webpack-server/tree/master/Examples/) for details.\n\n\n## License\n\nMIT\n","_attachments":{},"homepage":"https://github.com/gaearon/react-transform-hmr#readme","bugs":{"url":"https://github.com/gaearon/react-transform-hmr/issues"},"license":"MIT"}