rollup-plugin-install
raw JSON → 0.0.5 verified Fri May 01 auth: no javascript deprecated
A Rollup/Vite plugin that automatically installs missing dependencies during the build process. Version 0.0.5 (stable, no recent updates) integrates into Vite or Rollup config and triggers npm/yarn install when an imported module is not found. Differentiator: eliminates manual install steps during development, but limited to simple use cases and may not handle edge cases like version conflicts. Alternative to manual dependency management or tools like pnpm.
Common errors
error Error: Cannot find module 'some-package' ↓
cause Plugin did not run because options misconfigured or plugin not applied correctly.
fix
Ensure autoInstallPlugin is in the plugins array and options.bin is set correctly (npm/yarn).
Warnings
gotcha Plugin only triggers on build, not in dev server's hot reload. ↓
fix Manually install dependencies before starting dev server.
deprecated Package has not been updated since 2020; use at your own risk. ↓
fix Consider using alternative solutions like pnpm or manual install steps.
Install
npm install rollup-plugin-install yarn add rollup-plugin-install pnpm add rollup-plugin-install Imports
- autoInstallPlugin wrong
const { autoInstallPlugin } = require('rollup-plugin-install')correctimport { autoInstallPlugin } from 'rollup-plugin-install' - default import (autoInstallPlugin) wrong
const autoInstallPlugin = require('rollup-plugin-install')correctimport autoInstallPlugin from 'rollup-plugin-install'
Quickstart
// vite.config.js
import { defineConfig } from 'vite';
import { autoInstallPlugin } from 'rollup-plugin-install';
export default defineConfig({
plugins: [
autoInstallPlugin({ bin: 'npm' }),
],
});