0.2.0 • Published 12 months ago

unplugin-auto-install v0.2.0

Weekly downloads
-
License
MIT
Repository
github
Last release
12 months ago

unplugin-auto-install

NPM version

šŸ£ 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.

0.2.0

12 months ago