Skip to content

Commit

Permalink
fix: await writeBundle hook in webpack and rspack (#390)
Browse files Browse the repository at this point in the history
  • Loading branch information
yoannmoinet authored Jun 30, 2024
1 parent 48413d2 commit 5ab1a7b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/rspack/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,8 @@ export function getRspackPlugin<UserOptions = Record<string, never>>(
}

if (plugin.writeBundle) {
compiler.hooks.afterEmit.tap(plugin.name, () => {
plugin.writeBundle!()
compiler.hooks.afterEmit.tapPromise(plugin.name, async () => {
await plugin.writeBundle!()
})
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/webpack/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,8 @@ export function getWebpackPlugin<UserOptions = Record<string, never>>(
}

if (plugin.writeBundle) {
compiler.hooks.afterEmit.tap(plugin.name, () => {
plugin.writeBundle!()
compiler.hooks.afterEmit.tapPromise(plugin.name, async () => {
await plugin.writeBundle!()
})
}
}
Expand Down

0 comments on commit 5ab1a7b

Please sign in to comment.