-
Notifications
You must be signed in to change notification settings - Fork 213
Hot reload #1786
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
Hot reload #1786
Conversation
This entry point will be used for hot reloading, in order to initially retrieve digests of all assets, as build_runner might not know list of all of them, unlike client.
Instead of just 'update' emit json with updated build results and its digests
# Conflicts: # build_runner/lib/src/server/server.dart
Master merge in + enable Travis
It is expected that client code will become complicated, so in separate dart file it would be easier to test and maintain.
Reload any changed modules without any specific order, then reload main module and call main func to hopefully apply changes. Still need to get module dependency graph to reload in topological order and find correct ancessor chain where reloaded modules can be saved in closures.
We still lack handling situations when graph is dynamically updated between reloads.
- Get rid of `roughLibraryKeyDecode` - use library path exposed from dart runtime now. - Get load modules from cache directly and throw if it isn't loaded instead of using require.js and hoping that module already loaded and no network request would be done. - Don't mess with `.ddc` extension in `build_runner` code - encapsulate all of it on build_web_compilers side. Fixes #1760 Fixes #1762
- Rename live-reload to hot-reload - Add debug logging about reloading - Add documentation - Version bump and changelog Fixes #1766
var moduleValues = | ||
List<HotReloadableLibrary>.from(_jsObjectValues(moduleObj)); | ||
var moduleLibraries = moduleValues.map((x) => LibraryWrapper(x)); | ||
var module = Module(Map.fromIterables(moduleKeys, moduleLibraries)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: just return directly here
var moduleObj = dartLoader.getModuleLibraries(moduleId); | ||
if (moduleObj == null) { | ||
throw HotReloadFailedException("Failed to get module '$moduleId'. " | ||
"This error might appear if such module doesn't exist or isn't alredy loaded"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sp: already
(path) => dartLoader.urlToModuleId.get(currentOrigin + path), manager); | ||
|
||
var webSocket = | ||
WebSocket('ws://' + window.location.host, [_buildUpdatesProtocol]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: use string interpolation 'ws://${window.location.host}'
build_web_compilers/pubspec.yaml
Outdated
@@ -1,5 +1,5 @@ | |||
name: build_web_compilers | |||
version: 0.4.3-dev |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
did 0.4.3 get released? We can roll this into it if not.
Added
--hot-reload
cli option and appropriate functionality.