mirror of
https://github.com/unjs/unplugin.git
synced 2026-02-01 16:56:37 +00:00
Co-authored-by: Anthony Fu <anthonyfu117@hotmail.com>
This commit is contained in:
parent
9d0344cd6e
commit
c95f42dfe9
@ -20,6 +20,7 @@ Currently supports:
|
||||
| Hook | Rollup | Vite | Webpack 4 | Webpack 5 |
|
||||
| ---- | :----: | :--: | :-------: | :-------: |
|
||||
| [`buildStart`](https://rollupjs.org/guide/en/#buildstart) | ✅ | ✅ | ✅ | ✅ |
|
||||
| [`buildEnd`](https://rollupjs.org/guide/en/#buildend) | ✅ | ✅ | ✅ | ✅ |
|
||||
| `transformInclude`* | ✅ | ✅ | ✅ | ✅ |
|
||||
| [`transform`](https://rollupjs.org/guide/en/#transformers) | ✅ | ✅ | ✅ | ✅ |
|
||||
| [`enforce`](https://rollupjs.org/guide/en/#enforce) | ❌\*\* | ✅ | ✅ | ✅ |
|
||||
|
||||
@ -19,6 +19,7 @@ export interface UnpluginOptions {
|
||||
name: string;
|
||||
enforce?: 'post' | 'pre' | undefined;
|
||||
buildStart?: () => Promise<void> | void;
|
||||
buildEnd?: () => Promise<void> | void;
|
||||
transformInclude?: (id: string) => boolean;
|
||||
transform?: (this: UnpluginContext, code: string, id: string) => Thenable<TransformResult>;
|
||||
load?: (this: UnpluginContext, id: string) => Thenable<TransformResult>
|
||||
|
||||
@ -158,6 +158,12 @@ export function getWebpackPlugin<UserOptions = {}> (
|
||||
}
|
||||
|
||||
plugin.buildStart?.()
|
||||
|
||||
if (plugin.buildEnd) {
|
||||
compiler.hooks.done.tapAsync(plugin.name, () => {
|
||||
plugin.buildEnd!()
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user