The buildStart
hook is called once at the beginning of the build process. It’s great for:
This is your “before we begin” hook.
buildStart() {
console.log('Build is starting...')
}
The buildStart
hook is ideal for printing debug messages to the console, reading environment variables, and any other configuration tasks you need to do when your plugin is used during a Vite build.
Add a buildStart hook that prints a message when the build starts, then looks for an environment variable called MY_PLUGIN_API_KEY
and throws an error if it does not exist.