hasVitePlugin checks whether a Vite plugin has already been added to the Astro config.
hasVitePlugin
For example:
1import {2 defineIntegration,3 hasVitePlugin4} from "astro-integration-kit";5 6export default defineIntegration({7 // ...8 setup() {9 return {10 hooks: {11 "astro:config:setup": (params) => {12 const { logger } = params13 14 if (hasVitePlugin(params, { plugin: "vite-plugin-my-integration" })) {15 logger.warn("Vite plugin already exists!");16 }17 }18 }19 }20 }21})
1import { defineIntegration, withPlugins } from "astro-integration-kit";2import { hasVitePluginPlugin } from "astro-integration-kit/plugins";3 4export default defineIntegration({5 // ...6 setup({ name }) {7 return withPlugins({8 name,9 plugins: [hasVitePluginPlugin],10 hooks: {11 "astro:config:setup": (params) => {12 const { hasVitePlugin, logger } = params13 14 if (hasVitePlugin("vite-plugin-my-integration")) {15 logger.warn("Vite plugin already exists!");16 }17 }18 }19 })20 }21})