- Type:
string
Plugin name.
- Type:
'pre' | 'post'
Plugin execution order.
- Type:
(ctx: { command: string }) => void | Promise<void>
Called when build start.
- Type:
(ctx: { command: string, err?: Error }) => void | Promise<void>
Called when build end.
- Type:
(config: UserConfig, env: { command: string }) => UserConfig | Promise<UserConfig> | null
Return an object that will be deeply merged into the existing config, or directly modify the config object.
- Type:
(config: ResolvedConfig) => void | Promise<void>
Called when config resolved.
- Type:
(server: { middlewares: express.Application }) => void | Promise<void>
Can register pre or post middleware, or save server instance for other hooks.
// Register pre middleware
configureServer(server) {
server.middlewares.use((req, res, next) => {
});
}
// Register post middleware
configureServer(server) {
return () => {
server.middlewares.use((req, res, next) => {
});
};
}
- Type:
() => unplugin.Plugin[] | Promise<unplugin.Plugin[]>
Modify bundler config, return an array of unplugin plugins.
Not implemented
- Type:
() => Command | Promise<Command>
Register command.
Not implemented
- Type:
(html: string, ctx: { path: string, filename: string }) => string | Promise<string>
Modify html content.
Not implemented
- Type:
(code: string, ctx: { path: string, filename: string }) => string | Promise<string>
Modify entry content.
- Type:
(path: string, ctx: { event: 'create' | 'update' | 'delete' }) => void | Promise<void>
Called when file change.
Most hooks will pass in a ctx object, which contains some useful information.
- Type:
string
Return current command.
- Type:
ResolvedConfig
Return current config.
- Type:
string
Return current project directory.
- Type:
(message: string) => void
Print debug information.
- Type:
(message: string) => void
Print error information.
- Type:
(message: string) => void
Print information.
- Type:
UserConfig
Return current user config.
- Type:
(message: string) => void
Print warning information.