Skip to content

addVitePlugin

addVitePlugin allows you add a vite plugin to the Astro config. For example:

my-integration/index.ts
1
import {
2
defineIntegration,
3
addVitePlugin
4
} from "astro-integration-kit";
5
import { VitePWA } from 'vite-plugin-pwa'
6
7
export default defineIntegration({
8
// ...
9
setup() {
10
return {
11
hooks: {
12
"astro:config:setup": (params) => {
13
addVitePlugin(params, {
14
plugin: VitePWA({ registerType: 'autoUpdate' })
15
})
16
}
17
}
18
}
19
}
20
})