A Rollup plugin to specify additional directories and files for Rollup to watch during dev mode, complementing Rollup's built-in watch mechanism. Version 1.0.5 (stable) requires Node >=16 and peer dependency rollup ^2.x.x || ^3.x.x || ^4.x.x. It ships TypeScript definitions. Key differentiator: allows watching external assets not imported in code, preventing unnecessary dev server restarts. Low maintenance, minimal API surface (dir, include, exclude).
npm install rollup-plugin-watchVerified import paths — ran on the pinned version, not inferred.
Shows basic usage: watch a directory with include/exclude patterns for non-imported assets.
Set include: ['**/*'] to watch all files recursively within the directory.
Use arrays: include: ['file1', 'file2'] instead of include: 'file1'.
Ensure Rollup is running in watch mode (e.g., rollup -w) for the plugin to have any effect.
Only use in development configurations; do not expect it to work in build-only scripts.
Run npm install rollup-plugin-watch --save-dev and ensure the import uses default import.
Change import to: import watch from 'rollup-plugin-watch'.
Set dir to a single directory path as a string: dir: 'public'.