Skip to content

Commit

Permalink
feat(rspack): support buildStart (#319)
Browse files Browse the repository at this point in the history
* feat(rspack): support buildStart

* refactor: remove redundant if

---------

Co-authored-by: 三咲智子 Kevin Deng <[email protected]>
  • Loading branch information
Wyatex and sxzz authored Jul 3, 2023
1 parent 354b199 commit c9bbc97
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/rspack/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,13 @@ export function getRspackPlugin<UserOptions = {}>(
if (plugin.rspack)
plugin.rspack(compiler)

if (plugin.buildStart) {
compiler.hooks.make.tapPromise(plugin.name, async (compilation) => {
const context = createRspackContext(compilation)
return plugin.buildStart!.call(context)
})
}

if (plugin.buildEnd) {
compiler.hooks.emit.tapPromise(plugin.name, async (compilation) => {
await plugin.buildEnd!.call(createRspackContext(compilation))
Expand Down

0 comments on commit c9bbc97

Please sign in to comment.