definePlugin
Allows defining a type-safe plugin that can be used in defineIntegration
.
You can then use it in defineIntegration
:
Limitations
- A plugin only defines a utility that will be injected for a given hook
- A plugin can only use the built-in utilities (ie. the ones from the official Integration API)
- Plugins support overrides. That means that if 2 plugins declare the same
name
andhook
, the latest will be kept.
Practical examples
Astro Integration Kit uses definePlugin
for its core plugins under the hood,
have a look at our source for practical examples!
Authoring a plugin (soon) Learn how to write an Astro Integration Kit plugin the right way.