Skip to content

Commit e23fa02

Browse files
committed
docs(plugin): finalize dependency explanation and ESM usage
1 parent 3427ea4 commit e23fa02

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

src/content/contribute/writing-a-plugin.mdx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -302,8 +302,8 @@ T> The [`processAssets`](/api/compilation-hooks/#processassets) hook also suppor
302302

303303
## Watching for file changes
304304

305-
When webpack runs in watch mode (`webpack --watch` or `devServer`),
306-
Webpack creates a new compilation for each rebuild triggered by file changes.
305+
When webpack runs in watch mode (`webpack --watch` or `webpack serve`),
306+
it creates a new compilation for each rebuild triggered by file changes.
307307

308308
The `compiler.modifiedFiles` Set lets your plugin know **which specific
309309
files triggered the rebuild**, so you can skip expensive work for unrelated files.
@@ -326,7 +326,7 @@ class WatchNotifierPlugin {
326326
}
327327
}
328328

329-
module.exports = WatchNotifierPlugin;
329+
export default WatchNotifierPlugin;
330330
```
331331

332332
> **Note**:
@@ -340,9 +340,9 @@ module.exports = WatchNotifierPlugin;
340340
If your plugin reads external files (config files, templates, etc.)
341341
that webpack does not track by default, you must tell webpack to watch them.
342342

343-
The `compilation.fileDependencies` set allows you to add files that your plugin depends on, so webpack can trigger a rebuild when those files change.
343+
You can tell webpack to watch different types of dependencies:
344344

345-
You can also extend this behavior to other types of dependencies:
345+
- `compilation.fileDependencies` is used to track individual files that your plugin depends on, so webpack can trigger a rebuild when those files change
346346

347347
- `compilation.contextDependencies` is used to watch directories, so any change inside them triggers a rebuild
348348

0 commit comments

Comments
 (0)