mirror of
https://github.com/unjs/unplugin.git
synced 2025-12-08 20:26:33 +00:00
Co-authored-by: wawa0584 <60140118+WestonSeyler@users.noreply.github.com> Co-authored-by: 三咲智子 Kevin Deng <sxzz@sxzz.moe>
26 lines
815 B
Markdown
26 lines
815 B
Markdown
---
|
|
aside: false
|
|
lastUpdated: false
|
|
---
|
|
|
|
# Plugin Conventions
|
|
|
|
To have a better community and ecosystem, we encourage plugin authors to follow these conventions when creating unplugins.
|
|
|
|
- Plugins powered by Unplugin should have a clear name with `unplugin-` prefix.
|
|
- Include `unplugin` keyword in `package.json`.
|
|
- To provide better DX, packages could export 2 kinds of entry points:
|
|
- Default export: the returned value of `createUnplugin` function
|
|
|
|
```ts
|
|
import UnpluginFeature from 'unplugin-feature'
|
|
```
|
|
|
|
- Subpath exports: properties of the returned value of `createUnplugin` function for each bundler users
|
|
|
|
```ts
|
|
import VitePlugin from 'unplugin-feature/vite'
|
|
```
|
|
|
|
- Refer to [unplugin-starter](https://github.com/unplugin/unplugin-starter) for more details about this setup.
|