Registry / devops / webpack-watch-external-files-plugin

webpack-watch-external-files-plugin

JSON →
library4.1.0jsnpmunverified

A zero-dependency Webpack 5 plugin that triggers recompilation when external files (not part of the build graph) change. Current version 4.1.0 is ESM-only with Node >=20 required. Key differentiator: no dependencies, supports glob patterns and negations, lightweight alternative to manual watchers.

npm install webpack-watch-external-files-plugin
INSTALL
IMPORT
SIG · WEBPACK-WATCH-EXTE
W
webpack-watch-external-files-plugin
devopsjavascriptv4.1.0
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18223 runs
build_error
glibc
node 18223 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

WatchExternalFilesPlugin
import { WatchExternalFilesPlugin } from 'webpack-watch-external-files-plugin'
const WatchExternalFilesPlugin = require('webpack-watch-external-files-plugin')
ESM-only since v4.x; use v3.x for CJS.
default (WatchExternalFilesPlugin)
import WatchExternalFilesPlugin from 'webpack-watch-external-files-plugin'
import WatchExternalFilesPlugin from 'webpack-watch-external-files-plugin'
Default export also works, but named is preferred.
ts type
import type { WatchExternalFilesPluginOptions } from 'webpack-watch-external-files-plugin'
TypeScript types are bundled since v2.x.

Example webpack config showing how to watch external JSON configs excluding secrets.

import { WatchExternalFilesPlugin } from 'webpack-watch-external-files-plugin'; export default { plugins: [ new WatchExternalFilesPlugin({ files: ['/config/**/*.json', '!/config/secrets.json'], }), ], };
Debug
Known issues
breakingESM-only since v4.0: Cannot require() the module.
fix
Use import syntax or downgrade to v3.x.
affects: >=4.0.0
breakingNode.js >=20 required since v4.0.
fix
Upgrade Node.js to v20+ or use v3.x (requires Node >=16).
affects: >=4.0.0
breakingNode.js >=16 required since v3.0.
fix
Upgrade Node.js to v16+ or use v2.x (requires Node >=14).
affects: >=3.0.0 <4.0.0
gotchaNegated glob patterns are supported but must be part of the same array.
fix
Use the same pattern as in the example: files: ['**/*.txt', '!**/ignore.txt'].
affects: >=1.0.0
gotchaThe plugin does not ignore node_modules by default; you must explicitly add !**/node_modules/** if needed.
fix
Add '!**/node_modules/**' to the files array.
affects: >=1.0.0
Errors
Common errors & fixes
Cannot find module 'webpack-watch-external-files-plugin'
Missing install or Node.js version too low for ESM.
fix
npm install webpack-watch-external-files-plugin --save-dev and use Node >=20
WatchExternalFilesPlugin is not a constructor
Using require() on ESM-only v4+.
fix
Change require to import: import { WatchExternalFilesPlugin } from 'webpack-watch-external-files-plugin'
Error: [webpack-cli] Invalid configuration object. Webpack has been initialized using a configuration object that does not match the API schema.
Passing empty or invalid options (e.g., files missing).
fix
Ensure files option is an array of glob patterns.
Upgrade
Version history
4.1.0latest on npm
Audit
Dependencies
webpackrequiredpeer dependency for plugin hooks
Agent activity
6 hits · last 30 days
node
6
Resources