Skip to content
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

docs: fix the reference to process asset stages in examples #9485

Merged
merged 1 commit into from
Feb 27, 2025
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
9 changes: 6 additions & 3 deletions website/docs/en/api/plugin-api/compilation-hooks.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -725,10 +725,11 @@ Process the assets before emit.

```js
compiler.hooks.thisCompilation.tap('MyPlugin', compilation => {
const { Compilation } = compiler.webpack;
compilation.hooks.processAssets.tap(
{
name: 'MyPlugin',
stage: compilation.PROCESS_ASSETS_STAGE_ADDITIONAL,
stage: Compilation.PROCESS_ASSETS_STAGE_ADDITIONAL,
},
assets => {
const { RawSource } = compiler.webpack.sources;
Expand All @@ -743,10 +744,11 @@ compiler.hooks.thisCompilation.tap('MyPlugin', compilation => {

```js
compiler.hooks.thisCompilation.tap('MyPlugin', compilation => {
const { Compilation } = compiler.webpack;
compilation.hooks.processAssets.tap(
{
name: 'MyPlugin',
stage: compilation.PROCESS_ASSETS_STAGE_ADDITIONS,
stage: Compilation.PROCESS_ASSETS_STAGE_ADDITIONS,
},
assets => {
const asset = assets['foo.js'];
Expand All @@ -769,10 +771,11 @@ compiler.hooks.thisCompilation.tap('MyPlugin', compilation => {

```js
compiler.hooks.thisCompilation.tap('MyPlugin', compilation => {
const { Compilation } = compiler.webpack;
compilation.hooks.processAssets.tap(
{
name: 'MyPlugin',
stage: compilation.PROCESS_ASSETS_STAGE_OPTIMIZE,
stage: Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE,
},
assets => {
const assetName = 'unwanted-script.js';
Expand Down
9 changes: 6 additions & 3 deletions website/docs/zh/api/plugin-api/compilation-hooks.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -727,10 +727,11 @@ console.log(__webpack_require__.p);

```js
compiler.hooks.thisCompilation.tap('MyPlugin', compilation => {
const { Compilation } = compiler.webpack;
compilation.hooks.processAssets.tap(
{
name: 'MyPlugin',
stage: compilation.PROCESS_ASSETS_STAGE_ADDITIONAL,
stage: Compilation.PROCESS_ASSETS_STAGE_ADDITIONAL,
},
assets => {
const { RawSource } = compiler.webpack.sources;
Expand All @@ -745,10 +746,11 @@ compiler.hooks.thisCompilation.tap('MyPlugin', compilation => {

```js
compiler.hooks.thisCompilation.tap('MyPlugin', compilation => {
const { Compilation } = compiler.webpack;
compilation.hooks.processAssets.tap(
{
name: 'MyPlugin',
stage: compilation.PROCESS_ASSETS_STAGE_ADDITIONS,
stage: Compilation.PROCESS_ASSETS_STAGE_ADDITIONS,
},
assets => {
const asset = assets['foo.js'];
Expand All @@ -771,10 +773,11 @@ compiler.hooks.thisCompilation.tap('MyPlugin', compilation => {

```js
compiler.hooks.thisCompilation.tap('MyPlugin', compilation => {
const { Compilation } = compiler.webpack;
compilation.hooks.processAssets.tap(
{
name: 'MyPlugin',
stage: compilation.PROCESS_ASSETS_STAGE_OPTIMIZE,
stage: Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE,
},
assets => {
const assetName = 'unwanted-script.js';
Expand Down
Loading