{"id":22288,"library":"rollup-plugin-watch-globs","title":"rollup-plugin-watch-globs","description":"A Rollup plugin that extends the watch mode to monitor arbitrary file globs (e.g., static assets, stylesheets, HTML) not in the module graph. Currently v2.0.1, maintained by Caleb Evans. Key differentiator: unlike relying on Rollup's default watch (which only tracks JS/TS files in the dependency graph), this plugin explicitly adds glob patterns to trigger rebuilds, complementing tools like rollup-plugin-copy. Released under MIT License, requires rollup >=2.0.0 as a peer dependency. A lightweight, focused solution with no runtime dependencies beyond rollup.","status":"active","version":"2.0.1","language":"javascript","source_language":"en","source_url":"https://github.com/caleb531/rollup-plugin-watch-globs","tags":["javascript","rollup","rollup-plugin","watch"],"install":[{"cmd":"npm install rollup-plugin-watch-globs","lang":"bash","label":"npm"},{"cmd":"yarn add rollup-plugin-watch-globs","lang":"bash","label":"yarn"},{"cmd":"pnpm add rollup-plugin-watch-globs","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"peer dependency >=2.0.0","package":"rollup","optional":false}],"imports":[{"note":"Default ESM export. CommonJS require() works only if package supports dual CJS/ESM; check your Rollup config's format.","wrong":"const watchGlobs = require('rollup-plugin-watch-globs')","symbol":"watchGlobs","correct":"import watchGlobs from 'rollup-plugin-watch-globs'"},{"note":"In CommonJS, you must use .default because the package exports an ESM default.","wrong":"const watchGlobs = require('rollup-plugin-watch-globs')","symbol":"watchGlobs","correct":"const watchGlobs = require('rollup-plugin-watch-globs').default"},{"note":"The function accepts an array of glob strings, not an options object.","wrong":"plugins: [watchGlobs({ patterns: [...] })]","symbol":"rollup.config.js","correct":"plugins: [watchGlobs([ 'public/**/*.*', 'src/styles/*.scss' ])]"}],"quickstart":{"code":"// rollup.config.js\nimport watchGlobs from 'rollup-plugin-watch-globs';\n\nexport default {\n  input: 'src/index.js',\n  output: {\n    dir: 'dist',\n    format: 'esm'\n  },\n  plugins: [\n    watchGlobs([\n      'public/**/*.*',\n      'src/styles/*.scss'\n    ])\n  ]\n};\n","lang":"javascript","description":"Shows how to import and configure watchGlobs with two glob patterns to watch static assets and stylesheets."},"warnings":[{"fix":"Ensure the argument is an array: watchGlobs(['**/*.css'])","message":"Glob patterns must be provided as an array of strings, not an object or single string.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Combine with appropriate plugins for actions on change.","message":"This plugin only adds file watching; it does not handle actual copying or processing of watched files (use e.g., rollup-plugin-copy).","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Use import watchGlobs from 'rollup-plugin-watch-globs' and call it directly.","message":"v2.x changed the default export to be a callable function; previously it might have been a factory or object.","severity":"breaking","affected_versions":">=2.0.0"}],"env_vars":null,"search_vec":"'2.0.0':75 'add':56 'arbitrari':16 'asset':21 'beyond':88 'caleb':33 'complement':62 'copi':68 'current':29 'default':42 'depend':51,79,87 'differenti':36 'e.g':19 'evan':34 'explicit':55 'extend':10 'file':17,48 'focus':82 'glob':5,18,57 'graph':28,52 'html':23 'javascript':90 'js/ts':47 'key':35 'licens':72 'lightweight':81 'like':64 'maintain':31 'mit':71 'mode':13 'modul':27 'monitor':15 'pattern':58 'peer':78 'plugin':3,8,54,67,94 'rebuild':61 'releas':69 'reli':38 'requir':73 'rollup':2,7,40,66,74,89,91,93 'rollup-plugin':92 'rollup-plugin-copi':65 'rollup-plugin-watch-glob':1 'runtim':86 'solut':83 'static':20 'stylesheet':22 'tool':63 'track':46 'trigger':60 'unlik':37 'v2.0.1':30 'watch':4,12,43,95","created_at":"2026-04-27T17:04:23.059184+00:00","updated_at":"2026-04-27T17:04:23.059184+00:00","problems":[{"fix":"Use: import watchGlobs from 'rollup-plugin-watch-globs' (ESM) or const watchGlobs = require('rollup-plugin-watch-globs').default (CJS).","cause":"Incorrect import style (CommonJS without .default or wrong ESM import).","error":"TypeError: watchGlobs is not a function"},{"fix":"Wrap glob pattern in an array: watchGlobs(['public/**/*.*'])","cause":"Passed a string instead of an array of strings.","error":"Error: The 'watchGlobs' plugin hook 'watchChange' threw an error: Unexpected glob pattern"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/caleb531/rollup-plugin-watch-globs","docs":null,"changelog":null,"pypi":null,"npm":"https://www.npmjs.com/package/rollup-plugin-watch-globs","openapi_spec":null,"status_page":null,"smithery":null,"categories":["devops"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-18","next_check":"2026-07-26","install_tag":null}}