gaearon / react-hot-boilerplate

Minimal live-editing example for React
MIT License
3.91k stars 879 forks source link

Using boilerplate with react-hot-loader/webpack loader #119

Open arusakov opened 7 years ago

arusakov commented 7 years ago

I have made 2 simple changes in next branch:

My git diff:

diff --git a/.babelrc b/.babelrc
index 9b921a0..0466330 100644
--- a/.babelrc
+++ b/.babelrc
@@ -3,8 +3,5 @@
     ["es2015", {"modules": false}],
     "stage-2",
     "react"
-  ],
-  "plugins": [
-    "react-hot-loader/babel"
   ]
 }
diff --git a/webpack.config.js b/webpack.config.js
index 67cccb4..e2e4d89 100644
--- a/webpack.config.js
+++ b/webpack.config.js
@@ -35,6 +35,7 @@ module.exports = {
       {
         test: /\.jsx?$/,
         use: [
+          'react-hot-loader/webpack',
           'babel-loader',
         ],
         exclude: /node_modules/,

And everything is fine, no errors, hot reloading is working expect state saving. After every hot reloading state.counter become 0.

I don't know it is bug of react-hot-reload or it is bug of this configuration.

calesce commented 7 years ago

We'd prefer people use the Babel loader. Can you share what was happening previously?