-
Notifications
You must be signed in to change notification settings - Fork 760
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
Remove webpack-dev-server/client from entry #1135
Conversation
According to the https://webpack.js.org/guides/hot-module-replacement/ documentation, the client should not be an entry. It seems to be an old way of configuring (reference: article from 2016 https://medium.com/@rajaraodv/webpacks-hmr-react-hot-loader-the-missing-manual-232336dc0d96). When this line is removed, the HMR plugin correct _injects_ this entry into the configuration.
It appears that even after this change, I am seeing 2 versions of |
@tannerlinsley that's correct, that's a different "issue". It's probably because you explicitely added I'll read about that next if you'd like and submit another PR. |
Ah. I added it because it's mean to override the standard dev server code and not reload the page when things error. It's primarily for supporting things like react-hot-loader that offer inline-reloading of components. |
Got it! I think it's fine (for now) to have both |
@tannerlinsley When are you releasing the new version of react-static? |
Still waiting on some changes to play out on master with hot-reloading. Soon. |
Hey @tannerlinsley. Finally found something sane in the documentation. Combine that with this.
In other words:
|
So remove |
Not at my regular machine, so have not tested. Remove these:
Leave everything else the same. Can you try that out and see if it works as expected? ❤️ |
I'm on it. |
FYI, I'm trying to match this official configuration , but then using the |
Just tried it an hot-reloading fails silently during runtime. Nothing is triggered. |
This is what I have so far:
|
I think I know what is happening here:
If webpack-dev-server's code doesn't use |
Ah, so #1135 (comment) means that the first two options do work correctly if it weren't using
This makes sense that this would be the issue -- Why doesn't |
|
Yes. I don't even know if it's RHL's fault. Something is resolving to a separate copy of the dev server code and not syncing up on the socket instance. |
This could even be due to the dev environment of react-static. When npm-linked, webpack (which is running from within react-static files) will resolve to dependencies within react-static instead of the linked project. It's very possible that this isn't even a problem in actual projects that aren't npm-linked, but I don't want that to be an excuse for this not working. We should be able to develop in react-static and on linked projects seamlessly. Maybe an alias to resolve any emitter imports to the same file would be a good idea? |
I wholeheartedly agree with you! This should work regardless of the environment.
If that solves this for now, then sure! I'd rather have less duplication / 2 servers running. |
Is this in the same directory? because then it's indeed not the same path. |
Figured it out. An alias in dev mode to resolve |
Description
According to the webpack-dev-server documentation, the client should not be an entry. It seems to be an old way of configuring (I found this article from 2016 that shows the client as an entry point).
When this line is present, the webpack-dev-server is actually required twice, as you can see in the following image:
'webpack-dev-server/client?...'
)'../../webpack-dev-server/client?...'
)This would normally not be an issue. Identical requires are only executed once. However,
webpack-dev-server
as a plugin expects you to write:And the manual
entry
expects you to write:This results in two unique requires.
This might be a change they made recently, this might be a cross-env issue. I'm not certain. When this line is removed from the configuration, the HMR plugin correct injects this entry into the configuration, only once.
Fixes #1109
Changes/Tasks
Types of changes
Checklist: