Macil / react-hot-transform

Tweak React components in real time with Browserify.
MIT License
34 stars 0 forks source link

Only hot load js files #4

Closed Calvein closed 8 years ago

Calvein commented 8 years ago

That's an hotfix because it's impossible to require json files at the moment and it's better than renaming json files to js and adding export default

/home/donnees/workspaces/react-hot-transform-test/test.json:1
module.exports=/* REACT HOT LOADER */ if (module.hot) { (function () { var ReactHotAPI = require("/home/donnees/workspaces/.smallmultiple/oeh/oeh-who-cares/frontend/node_modules/react-hot-api/modules/index.js"), RootInstanceProvider = require("/home/donnees/workspaces/.smallmultiple/oeh/oeh-who-cares/frontend/node_modules/react-hot-loader/RootInstanceProvider.js"), ReactMount = require("react/lib/ReactMount"), React = require("react"); module.makeHot = module.hot.data ? module.hot.data.makeHot : ReactHotAPI(function () { return RootInstanceProvider.getRootInstances(ReactMount); }, React); })(); } try { (function () {
                                      ^
ParseError: Unexpected token
Macil commented 8 years ago

This would break .jsx files. (Are there any other common extensions?)

But you should use https://github.com/gaearon/react-transform-hmr instead of this project. I forgot to update the readme to mention that this project is deprecated now.

Calvein commented 8 years ago

Thanks for the heads up, it's all good now with react-transform-hmr :+1: