Skip to content

docs: add note for non extensibility of hooks #7160

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/content/api/compilation-hooks.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ contributors:
- EugeneHlushko
- chenxsan
- jamesgeorge007
- snitin315
---

The `Compilation` module is used by the `Compiler` to create new compilations
Expand All @@ -30,6 +31,8 @@ compilation.hooks.someHook.tap(/* ... */);
As with the `compiler`, `tapAsync` and `tapPromise` may also be available
depending on the type of hook.

W> Since webpack 5, `hooks` are no longer extendable. Use a `WeakMap` to add custom hooks.

### buildModule

`SyncHook`
Expand Down
5 changes: 4 additions & 1 deletion src/content/api/compiler-hooks.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,17 @@ contributors:
- EugeneHlushko
- superburrito
- chenxsan
- snitin315
---

The `Compiler` module is the main engine that creates a compilation instance
with all the options passed through the [CLI](/api/cli) or [Node API](/api/node). It extends the
`Tapable` class in order to register and call plugins. Most user-facing plugins
are first registered on the `Compiler`.

When developing a plugin for webpack, you might want to know where each hook is called. To learn this, search for `hooks.<hook name>.call` across the webpack source
When developing a plugin for webpack, you might want to know where each hook is called. To learn this, search for `hooks.<hook name>.call` across the webpack source.

W> Since webpack 5, `hooks` are no longer extendable. Use a `WeakMap` to add custom hooks.

## Watching

Expand Down
3 changes: 3 additions & 0 deletions src/content/api/parser.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ contributors:
- misterdev
- EugeneHlushko
- chenxsan
- snitin315
---

The `parser` instance, found in the `compiler`, is used to parse each module
Expand Down Expand Up @@ -36,6 +37,8 @@ depending on the type of hook.
The following lifecycle hooks are exposed by the `parser` and can be accessed
as such:

W> Since webpack 5, `hooks` are no longer extendable. Use a `WeakMap` to add custom hooks.

### evaluateTypeof

`SyncBailHook`
Expand Down