{"name":"react-transform-catch-errors","version":"0.1.3","description":"React Transform that catches errors inside React components","main":"lib/index.js","repository":{"type":"git","url":"git+https://github.com/gaearon/react-transform-catch-errors.git"},"author":{"name":"Dan Abramov","email":"dan.abramov@me.com"},"license":"MIT","bugs":{"url":"https://github.com/gaearon/react-transform-catch-errors/issues"},"homepage":"https://github.com/gaearon/react-transform-catch-errors#readme","scripts":{"clean":"rimraf lib","build":"babel src --out-dir lib","prepublish":"npm run clean && npm run build"},"keywords":["react-transform","react","reactjs","errors","rhl","dx"],"devDependencies":{"babel":"^5.8.23","rimraf":"^2.4.3"},"gitHead":"40980647564746054501008d5f1470155f77322f","_id":"react-transform-catch-errors@0.1.3","_shasum":"dfac74aa51444ae741a1de8a55b4a98ed59f60f7","_from":".","_npmVersion":"2.11.0","_nodeVersion":"2.2.1","_npmUser":{"name":"gaearon","email":"dan.abramov@gmail.com"},"dist":{"shasum":"dfac74aa51444ae741a1de8a55b4a98ed59f60f7","tarball":"http://registry-npm.ywwl.com/react-transform-catch-errors/download/react-transform-catch-errors-0.1.3.tgz","integrity":"sha512-k65Ng9Z117x08tld+IsYfLy0lhXWr/HbMKJvXD2KtyW99kWTnkU4tVxEt61XUdGZxVEYitGPWcb/LDF55ZyonA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIG7BcptLg7vUuBGH1oDCQP3jym8WU8Kl/iK5jlr+1gFBAiAfIZ5jDGAGGDAxw+Xk1bAoO9uVAlPYMTzz//j9uivACA=="}],"size":3242,"noattachment":false,"key":"/react-transform-catch-errors/-/react-transform-catch-errors-0.1.3.tgz"},"maintainers":[{"name":"gaearon","email":"dan.abramov@gmail.com"}],"directories":{},"readme":"# react-transform-catch-errors\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\nA [React Transform](https://github.com/gaearon/babel-plugin-react-transform) that catches errors inside `render()` function and renders a React component with an error message instead.\n\nIt’s up to you to choose the React component to render an error message. For example, you may use [redbox-react](https://github.com/KeywordBrain/redbox-react) that imitates React Native “red screen of death”.\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-catch-errors\n```\n\nFinally, install the component for rendering errors, for example:\n\n```js\nnpm install --save-dev redbox-react\n```\n\nYou may also use a custom component instead.\n\nNow edit your `.babelrc` to include `extra.babel-plugin-react-transform`.  \nIt must be an 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-catch-errors\",\n          // now go the imports!\n          \"imports\": [\n\n            // the first import is your React distribution\n            // (if you use React Native, pass \"react-native\" instead)\n\n            \"react\",\n\n            // the second import is the React component to render error\n            // (it can be a local path too, like \"./src/ErrorReporter\")\n\n            \"redbox-react\"\n\n            // the third import is OPTIONAL!\n            // when specified, its export is used as options to the reporter.\n            // see specific reporter's docs for the options it needs.\n\n            // it will be imported from different files so it either has to be a Node module\n            // or a file that you configure with Webpack/Browserify/SystemJS to resolve correctly.\n            // for example, see https://github.com/gaearon/babel-plugin-react-transform/pull/28#issuecomment-144536185\n\n            // , \"my-reporter-options\"\n          ]\n        }]\n        // note: you can put more transforms into array\n        // this is just one of them!\n      }]]\n    }\n  }\n}\n```\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=development`. See [babelrc documentation](https://babeljs.io/docs/usage/babelrc/#env-option) for more details about using `env` option.\n\n## License\n\nMIT\n","publish_time":1442335122053,"_cnpm_publish_time":1442335122053,"dist-tags":{"latest":"1.0.2"}}