webpacker-react
webpacker-react copied to clipboard
Config patch for HMR breaks with Webpacker 3.1
Webpacker 3.1 introduces a new API to setup Webpacker, and this breaks our use of webpack-merge
. This will be fixed in Webpacker 3.1.2, but we should switch to the Webpacker API to properly handle this.
See https://github.com/rails/webpacker/issues/1097
Here's what you need, this working for me with webpacker 3.2, and maintaining state between patches.
development.js
const environment = require('./environment')
const merge = require('webpack-merge')
const babelLoader = environment.loaders.get('babel').use.find(el => el.loader === 'babel-loader')
babelLoader.options = merge(babelLoader.options, { plugins: ['react-hot-loader/babel'] })
const entries = environment.entry
Object.keys(entries).forEach((entry) => {
entries.set(entry, ['react-hot-loader/patch', entries[entry]])
});
module.exports = environment.toWebpackConfig()
I'll create PR if you like?
@renchap Is it on the roadmap to fix this? Currently this repo is incompatible with the latest stable release of rails (5.2). Is this repo still active?