Skip to content

addIntegration

addIntegration allows you to add an integration from within an integration.

It will also do a check using hasIntegration to check whether the integration you’re trying to add has already been added. If it has, it won’t add it again.

my-integration/index.ts
import {
defineIntegration,
addIntegration
} from "astro-integration-kit";
import Vue from "@astrojs/vue";
export default defineIntegration({
// ...
setup() {
return {
hooks: {
"astro:config:setup": (params) => {
addIntegration(params, {
integration: Vue()
})
}
}
}
}
})

By default addIntegration will fail if you try to add an integration that’s already been added.

You can bypass this and add it anyway with the ensureUnique flag.

integration.ts
addIntegration(params, {
integration: Vue(),
ensureUnique: false
})