update HMR to support kjol
This commit is contained in:
@@ -26,6 +26,9 @@ func (d *devServer) watch() {
|
||||
go d.cssLoop()
|
||||
|
||||
roots := []string{d.srcRoot, filepath.Join(d.frontend, "css")}
|
||||
if webDir != "" { // cross-tree: also watch the shared kjol web kit + styles
|
||||
roots = append(roots, d.kitRoot)
|
||||
}
|
||||
mtimes := map[string]time.Time{}
|
||||
d.scan(roots, mtimes, nil) // seed: record current state, emit nothing
|
||||
|
||||
@@ -117,7 +120,7 @@ func (d *devServer) handleChanges(changed []string) {
|
||||
|
||||
// hmrJS turns one changed source module into a hot update or a full reload.
|
||||
func (d *devServer) hmrJS(abs string) {
|
||||
rel := filepath.ToSlash(mustRel(d.srcRoot, abs))
|
||||
rel := d.moduleID(abs)
|
||||
boundaries, version, reload := d.graph.invalidate(abs)
|
||||
if reload {
|
||||
fmt.Printf("[hmr] full reload (%s)\n", rel)
|
||||
@@ -131,7 +134,7 @@ func (d *devServer) hmrJS(abs string) {
|
||||
updates := make([]hmrUpdate, 0, len(boundaries))
|
||||
for _, b := range boundaries {
|
||||
updates = append(updates, hmrUpdate{
|
||||
Path: srcURLPrefix + filepath.ToSlash(mustRel(d.srcRoot, b)),
|
||||
Path: d.moduleURLBase(b),
|
||||
Timestamp: version,
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user