Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use React Transform instead of React Hot Loader #55

Closed
gaearon opened this issue Sep 3, 2015 · 7 comments · Fixed by #64
Closed

Use React Transform instead of React Hot Loader #55

gaearon opened this issue Sep 3, 2015 · 7 comments · Fixed by #64

Comments

@gaearon
Copy link
Collaborator

gaearon commented Sep 3, 2015

React Transform is a Babel plugin for applying runtime transformations to React classes. Combined with react-transform-webpack-hmr, it replaces React Hot Loader completely.

Benefits:

  • No need to work around dependency on react/lib/ReactMount
  • Does not depend on react package: you can give it react-native in configuration just fine
  • Better works with ES6 features like getters, and is much more stable
  • Allows other transformations, e.g. react-transform-catch-errors
@amccloud
Copy link
Collaborator

amccloud commented Sep 3, 2015

@gaearon will give it a shot this weekend

@ptmt
Copy link

ptmt commented Sep 15, 2015

+1. @amccloud if you don't mind I could help with that. Do you have any progress?

@amccloud
Copy link
Collaborator

I do not have any progress yet.

On Tuesday, September 15, 2015, Dmitry notifications@github.com wrote:

+1. @amccloud https://github.com/amccloud if you don't mind I could
help with that. Do you have any progress?


Reply to this email directly or view it on GitHub
#55 (comment)
.

@gaearon
Copy link
Collaborator Author

gaearon commented Sep 17, 2015

FYI—I'm on it.

@gaearon
Copy link
Collaborator Author

gaearon commented Sep 17, 2015

@elliottsj I'm having some super weird issues working on it—any chance you could give me a few minutes on Slack?

@davecoates
Copy link

@gaearon - I had something working on the weekend for this but I'm getting errors trying again now (Uncaught SyntaxError: Unexpected reserved word) - I swear nothing changed! In case it helps you: https://github.com/davecoates/react-native-webpack-server/tree/react-transform

My .babelrc

{
  "env": {
    "stage": 0,
    "development": {
      "plugins": [
        "react-transform"
      ],
      "extra": {
        "react-transform": [
        {
          "target": "react-transform-webpack-hmr",
          "imports": ["react-native"],
          "locals": ["module"]
        },
         {
          "target": "react-transform-catch-errors",
          "imports": ["react-native", "./src/ErrorReporter"]
        }
        ]
      }
    }
  }
}

Relevant part of webpack.config.js

if (process.env.HOT) {
  config.devtool = 'inline-source-map'; // Speed up incremental builds
  config.entry['index.ios'].unshift('webpack-hot-middleware/client?path=http://localhost:8080/__webpack_hmr');
  config.output.publicPath = 'http://localhost:8080/';
  config.plugins.unshift(new webpack.HotModuleReplacementPlugin());
}

@gaearon
Copy link
Collaborator Author

gaearon commented Sep 17, 2015

Please see #64 and test it on your projects!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants