unplugin-auto-install
v0.2.0
Published
A universal bundler plugin which automatically installs dependencies that are imported by a bundle, even if not yet in `package.json`.
Maintainers
Readme
unplugin-auto-install
🍣 A universal bundler plugin which automatically installs dependencies that are imported by a bundle, even if not yet in package.json.
Install
npm i unplugin-auto-install// vite.config.ts
import UnpluginAutoInstall from 'unplugin-auto-install/vite'
export default defineConfig({
plugins: [
UnpluginAutoInstall({
/* options */
}),
],
})Example: playground/
// rollup.config.js
import UnpluginAutoInstall from 'unplugin-auto-install/rollup'
export default {
plugins: [
UnpluginAutoInstall({
/* options */
}),
],
}// webpack.config.js
module.exports = {
/* ... */
plugins: [
require('unplugin-auto-install/webpack')({
/* options */
}),
],
}// nuxt.config.js
export default defineNuxtConfig({
modules: [
[
'unplugin-auto-install/nuxt',
{
/* options */
},
],
],
})This module works for both Nuxt 2 and Nuxt Vite
// vue.config.js
module.exports = {
configureWebpack: {
plugins: [
require('unplugin-auto-install/webpack')({
/* options */
}),
],
},
}// esbuild.config.js
import { build } from 'esbuild'
import UnpluginAutoInstall from 'unplugin-auto-install/esbuild'
build({
plugins: [UnpluginAutoInstall()],
})Usage
Options
For all options please refer to docs.
This plugin accepts all @rollup/plugin-auto-install options.
