olahol / reactpack

:package: build your react apps with one command and one `npm i`.
982 stars 36 forks source link

Add react-hot-loader #29

Closed victorb closed 8 years ago

victorb commented 8 years ago

Currently, hot-reloading is kindish setup but not fully, we're missing to include react-hot-loader to make the components reload without a full page refresh. If interested, the change would be from:

  var babelLoaderQuery = {
    presets: [
      'babel-preset-es2015',
      'babel-preset-react',
      'babel-preset-stage-0'
    ].map(require.resolve)
  }
 // [...]
  loaders.push({
    test: /\.jsx?$/,
    exclude: /(node_modules|bower_components)/,
    loader: 'babel',
    query: babelLoaderQuery
  })

To something more like this:

  loaders.push({
    test: /\.jsx?$/,
    exclude: /(node_modules|bower_components)/,
    loaders: ['react-hot', 'babel?presets[]=es2015,presets[]=react,presets[]=stage-0']
  })

And add react-hot-loader to the list of dependencies.

Thoughts?

olahol commented 8 years ago

I think this a good idea, I remember not implementing it because I was unsure how it would work with custom a .babelrc, but I just got it to work with json stringifying the babel query. Thanks again @VictorBjelkholm, react-hot-loader is now in version 0.8.0.