Unplugin: Unified Plugin System for Build Tools
repository·main·Indexed Apr 15, 2026
https://github.com/unjs/unpluginUnplugin is a unified plugin system enabling developers to write plugins once and run them across various build tools and runtimes, including Vite, Rollup, webpack, esbuild, Rspack, Farm, Rolldown, and Bun. It abstracts differences between bundlers by providing a consistent API for hooks like resolveId, load, and transform. The library supports creating custom plugins via the createUnplugin factory, handling source maps, emitting files, and managing virtual modules. Official templates and conventions are available for plugin development.
What's inside unplugin
Overview and Installation
mainOverview and Supported Build Tools
mainAccess Build Tool Versions and Metadata
mainUse the
metaobject passed to your plugin factory to access runtime information about the host environment. This is useful for conditional logic based on the build tool or its version.meta.framework: Returns the name of the framework (e.g.,'vite','webpack','rollup').meta.versions: An object containing version strings for the framework and unplugin itself.meta.versions[meta.framework]: The version of the host framework (e.g.,'7.0.0').meta.versions.unplugin: The version of the unplugin library.meta.versions.rollupormeta.versions.rolldown: The underlying bundler version when running inside Vite.
Note: For Rollup-compatible hosts (Vite, Rollup, Rolldown, Unloader), framework versions are only available after the
buildStarthook is executed. Vite requires version 7.0.0 or later to providemeta.versions.vite.Sources:
unknownGetting Started
mainTo begin using Unplugin:
- Read the Guide: Start with the Getting Started guide to learn how to install and create plugins.
- Explore the Showcase: See what others are building with Unplugin Showcase.
- View on GitHub: Contribute or report issues on the GitHub repository.
Sources:
docs/index.mdUnplugin Templates
mainTo quickly get started with creating your own Unplugin, use one of the official starter templates:
Check these repositories for more details on setting up a new Unplugin package.
Sources:
docs/guide/index.mdInstall and Configure Unplugin
mainInstall and Configure Unplugin
mainUnplugin is a unified plugin system that allows you to write plugins once and run them across various build tools and runtimes.Supported Build Tools
mainUnplugin currently supports:
- Vite
- Rollup
- webpack
- esbuild
- Rspack
- Rolldown
- Farm
- Bun
Sources:
docs/guide/index.mdInstallation
mainInstall the unplugin package using your preferred package manager:
npm install unplugin --save-devyarn add unplugin -Dpnpm add unplugin -Dbun add unplugin -DImportant Notes
mainParser Implementation: For bundlers other than Rollup, Rolldown, or Vite,
setParseImplmust be called to manually provide a parser implementation. Parsers such as Acorn, Babel, or Oxc can be used.emitFile Limitation: Currently,
this.emitFileonly supports theEmittedAssetvariant.
Sources:
docs/guide/index.mdQuick Start
mainTo get started, visit the official documentation at https://unplugin.unjs.io for detailed guides on installation and usage.