Webpack plugin that watches files and folders outside webpack's default watch scope using glob patterns. Version 1.2.0. It relies on chokidar for file system monitoring and triggers webpack recompilation when glob-matched files change. Unlike similar plugins (e.g., file-watcher-webpack-plugin, webpack-watch-files-plugin), this one supports recursive directory watching, custom event handlers via chokidar's API, and granular ignore patterns. The package is ESM-only. Note: The plugin's constructor expects an object with a 'watchFileRegex' property (string or array of strings). Common issues include incorrect require style (CJS vs ESM) and misconfiguring the watch path glob (must be relative to the project root).
npm install filewatcher-webpack-pluginVerified import paths — ran on the pinned version, not inferred.
Configures the plugin in a webpack config file, watching JS and CSS files outside webpack's default watch scope.
Change require() to import statements (ESM) or use a dynamic import wrapper.
Use a string glob pattern like './dir/**/*.js' — not a RegExp literal.
Add `ignored: /node_modules/` to the constructor options.
Use absolute paths or paths relative to process.cwd().
Update to v1.2.0+ which explicitly supports webpack 5.
Switch to import statement: `import FileWatcherPlugin from 'filewatcher-webpack-plugin'`
Use `new FileWatcherPlugin(...)` after default import, not `new (await import(...)).FileWatcherPlugin(...)`.
Use glob patterns (e.g., './**/*.js') not RegExp (e.g., /\.js$/).
Verify absolute/relative path and ensure 'ignored' does not cover the target files.