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

Config patch for HMR breaks with Webpacker 3.1 #49

Open
renchap opened this issue Dec 14, 2017 · 2 comments
Open

Config patch for HMR breaks with Webpacker 3.1 #49

renchap opened this issue Dec 14, 2017 · 2 comments

Comments

@renchap
Copy link
Owner

renchap commented Dec 14, 2017

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 rails/webpacker#1097

@raldred
Copy link

raldred commented Mar 18, 2018

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?

@ajsharp
Copy link

ajsharp commented Jan 14, 2019

@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?

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

No branches or pull requests

3 participants