-
Notifications
You must be signed in to change notification settings - Fork 1.5k
webpack-dev-server live reload issue fix #2892
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
Conversation
For the webpack-dev-server 3 the automatic client injection is made here: This works well with webpack 4 as the config.target is 'web' and the webTarget var becomes true. As far as I can see, this "target" check was introduced to solve problems building "isomorphic" applications, when the server and the client-side build is going in the same env. So if I understand this correctly, this is completely not related to the apps with the ruby backend. And the injectClient setting can be forced without any side-effects. |
@gauravtiwari Happy to this reviewed and merged asap 🎉 |
@crawler This PR targets compatibility with webpack-dev-server v3, v4 or both? 🤝 |
@pedrofurtado Both |
@crawler Strange 🤔 When i set in Gemfile and package.json the webpacker to get from Maybe because the fork is not sync with master yet ... I guess 🤝 |
Plase try the master branch |
@crawler Now works like a charm! 🎉 🎉 @gauravtiwari I can confirm this PR works (automatic f5 refresh based on file changes) well with latest stable version of webpack-dev-server and this gem itself. Thanks for your contribution @crawler 🤝 ! |
@pedrofurtado thank you for checking this out 🤝 |
thanks, both 🙏 |
@gauravtiwari @pedrofurtado this does not work for HMR of CSS modules. More details in #2338. |
In combination with #2890 fixes #2832.
Since webpack 5, the default compiler target is browserslist (when available), and it is not being recognized by the webpack-dev-server as a target for client injection by default. Because it searches through:
[ 'web', 'webworker', 'electron-renderer', 'node-webkit', undefined, null ]
So, even this can be a webpack-dev-server issue, we need to set this setting explicitly to have Live Reload or HMR working.