Deprecate devServer.reactHot()
sapegin opened this issue · 10 comments
- There are several open issues and PRs: #56, #131.
- It’s not generic, works only for React.
- It’s only one of possible hot reload solutions for React.
- None of them are actively maintained.
- The need for it is overvalued in my opinion, default webpack hot reload is good enough.
- It was always broken in 1.0
// test-app/webpack.config.babel.js
const developmentConfig = () => group([
sourceMaps(),
devServer(),
+ devServer.reactHot(),
devServer.proxy({
'/api/*': { target: 'http://localhost:4000' }
}),
→
ERROR in Error: Child compilation failed:
Module not found: Error: Can't resolve 'react-hot' in '/Users/sapegin/webpack-blocks/test-app'
BREAKING CHANGE: It's no longer allowed to omit the '-loader' suffix when using loaders.
You need to specify 'react-hot-loader' instead of 'react-hot',
see https://webpack.js.org/guides/migrating/#automatic-loader-module-name-extension-removed:
Since it has been broken in 1.0 anyway, we might as well remove it directly. Might or might not provide a devServer.reactHot
function that just throws an error with a meaningful message.
Opinions?
I’m fine with both: removing or deprecating ;-)
As I think about it... Having a devServer.reactHot
function that just throws would only be useful if we already had an alternative to use instead.
What kind of alternative do you mean? A third-party block?
Yeah, something else (a new block) to take care of the job. Only then it would make real sense to have a custom error message (could then point to the new block).
The I’d just remove it entirely ;-) I think it should be a third-party block if anyone would want to maintain it.
Do we have any other opinions here?
Just remove it. It's simple enough to setup react-hot-loader
manually on top of dev server or hot middleware.
5 .The need for it is overvalued in my opinion, default webpack hot reload is good enough.
I disagree, hot reloading is super useful.
@vlad-zhukov I’d say vanilla webpack hot reload is super useful. React hot reload is not that useful in its current state ;-)
It replaces the page content without reloading the page. Think of a complicated page, that does multiple requests and requires some actions from a user (e.g. a form). How the possibility to develop such page without a need to do all that stuff all over again is not useful? Also if you have css in js, it reloads styles too!
I know what it does, I used to use it for quite a long time ;-) Vanilla hot reload works fine with styles and isolated component development is much better solution for developing complex components.
Anyway it’s so opinionated, there’s no point in arguing — use what works for your, your team and your project.
And let’s remove it from webpack-blocks if no one disagrees on that?