Skip to content

Commit

Permalink
fix(hmr): emit reload event on success
Browse files Browse the repository at this point in the history
  • Loading branch information
shigma committed Apr 30, 2024
1 parent db9530a commit 8fa2175
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion packages/hmr/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@cordisjs/plugin-hmr",
"description": "Hot Module Replacement Plugin for Cordis",
"version": "0.2.0",
"version": "0.2.1",
"type": "module",
"main": "lib/index.js",
"typings": "lib/index.d.ts",
Expand Down
6 changes: 3 additions & 3 deletions packages/hmr/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -287,9 +287,6 @@ class Watcher extends Service {
return rollback()
}

// emit reload event before replacing loader cache
this.ctx.emit('hmr/reload', reloads)

const reload = (plugin: any, children: ForkScope[]) => {
for (const oldFork of children) {
const fork = oldFork.parent.plugin(plugin, oldFork.config)
Expand Down Expand Up @@ -332,6 +329,9 @@ class Watcher extends Service {
return
}

// emit reload event on success
this.ctx.emit('hmr/reload', reloads)

// reset stashed files
this.stashed = new Set()
}
Expand Down

0 comments on commit 8fa2175

Please sign in to comment.