-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Web hot reload breaks app when running as Web Server (-d web-server) #60289
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
Comments
Thanks for the report! The docs here describe the AFAIK the hot reload support is tightly coupled with Chrome DevTools to control the execution and synchronize events in the Dart tooling while libraries are being replaced in the browser at runtime. We don't have any plans to expand that to support developer tools in other browsers at this time. @srujzs @jyameo |
Can we confirm whether or not hot restart was working when running with the 'web-server' device? If so it seems like adding similar support for hot reload should be doable. But if not, I don't think we need to add it at the moment. More generally though, even if hot reload isn't supported, this implies our new module system isn't working with this run configuration. I repro-ed this locally and didn't see any errors in the console. I think the |
I do see us using the With AMD, this doesn't seem to be an issue, because Hot restart also requires a hard refresh of the page with the web server (probably because DWDS isn't there to handle it correctly). |
It makes sense that a refresh is required given nothing is attached to the running browser. So in that case hot reload itself doesn't make sense in this context. I don't think there's a need to try to attach DWDS onto the Chrome process in this But we do need apps to run in this environment. We will need to figure out what should be loading the sources into the page for the dartDevEmbedder. More generally, we should decouple the initial sources loading from DWDS. Hot reload and hot restart will require a running debug service but the program should still run in environments where those features aren't supported. Can we inject information into the bootstrap script that allows it to load the sources itself? |
We could reuse some of the DWDS code to do that part: https://github.com/dart-lang/webdev/blob/8f146a15fba4d7c0dc76b51e083a5459216126cf/dwds/lib/src/handlers/injector.dart#L95 without needing the injected client or any of the code to set up DWDS debugging. Separating out that latter part so we don't try and include it and just setting up the right code to handle loading and fetching sources will require work in DWDS. It's likely preferable to use DWDS for that purpose instead of reimplementing all the logic to parse module metadata and set up paths correctly. FYI @bkonyi |
I can take a look at this issue. I'll follow Srujan's suggestion to reuse parts of DWDS in Flutter tools to load the necessary files. will reach out if I have any questions or run into issues. |
I don't know how it works under the hood but i am running the web-server device commonly and using hot-reload on every time i save a file. Atleast that triggers the hot-reload, when running in debug I am also required to attach the debugger with the browser add-on. |
That's interesting... a couple of us were able to reproduce the issue consistently, so I'm surprised to hear that hot reload is working for you in this context. Could you share more details about the Flutter/Dart version you're using? I'm currently rolling out a fix that will reuse parts of DWDS to handle source loading without requiring the injected client or DWDS debugging. |
…165820) This change ensures that `injectDebuggingSupportCode` in DWDS is set based on the specified device ID, defaulting to Chrome. This complements the changes made in dart-lang/webdev#2601 and ensures that debugging support is correctly configured for different environments. fixes dart-lang/sdk#60289
…165820) This change ensures that `injectDebuggingSupportCode` in DWDS is set based on the specified device ID, defaulting to Chrome. This complements the changes made in dart-lang/webdev#2601 and ensures that debugging support is correctly configured for different environments. fixes dart-lang/sdk#60289
Steps to reproduce
flutter run -d web-server --web-experimental-hot-reload
Notice that the served Flutter application fails to load and just renders a blank screen.
Failure Case
Running
flutter run -d web-server --web-experimental-hot-reload
and opening relevant localhost (http://localhost:53392):WAI Cases
Running
flutter run -d web-server
and opening relevant localhost (http://localhost:53392):Running
flutter run -d chrome --web-experimental-hot-reload
:Code sample
N/A (always breaks regardless of app details)
Flutter version
Flutter version observing the above behavior.
Side note: I tried upgrading to the latest version on
master
and running on chrome (with hot reload) but that failed entirely. I won't file another ticket as I'm guessing it will be fixed soon, but just in case here's the Flutter version for that:Second side note: This is extremely impressive work and such a major value add to the Flutter community! Congrats to all involved! 🎉
The text was updated successfully, but these errors were encountered: