Unified plugin that combines other plugins into one plugin.
Currently supports:
npm i unplugin-combine
Similar to unplugin.
import { type OptionsPlugin, createCombinePlugin } from 'unplugin-combine'
export const unplugin = createCombinePlugin((userOptions: UserOptions = {}) => {
const plugins: OptionsPlugin[] = [plugin1, plugin2, plugin3]
return {
name: 'unplugin-combine-xxxx',
plugins,
}
})
export const vitePlugin = unplugin.vite
export const rollupPlugin = unplugin.rollup
export const rolldownPlugin = unplugin.rolldown
export const webpackPlugin = unplugin.webpack
export const rspackPlugin = unplugin.rspack
export const esbuildPlugin = unplugin.esbuild
// vite.config.ts
import UnpluginFeature from './unplugin-feature'
export default {
plugins: [
UnpluginFeature.vite({
/* options */
}),
],
}
// rollup.config.js
import UnpluginFeature from './unplugin-feature'
export default {
plugins: [
UnpluginFeature.rollup({
/* options */
}),
],
}
// webpack.config.js
module.exports = {
plugins: [
require('./unplugin-feature').webpack({
/* options */
}),
],
}
// rspack.config.js
module.exports = {
plugins: [
require('./unplugin-feature').rspack({
/* options */
}),
],
}
// esbuild.config.js
import { build } from 'esbuild'
build({
plugins: [
require('./unplugin-feature').esbuild({
/* options */
}),
],
})