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(plugins): add stage option for BannerPlugin #7196

Merged
merged 1 commit into from
Mar 22, 2024
Merged
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: 9 additions & 0 deletions src/content/plugins/banner-plugin.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ contributors:
- simon04
- byzyk
- chenxsan
- snitin315
related:
- title: banner-plugin-hashing test
url: https://github.com/webpack/webpack/blob/main/test/configCases/plugins/banner-plugin-hashing/webpack.config.js
Expand All @@ -31,6 +32,7 @@ new webpack.BannerPlugin(options);
include: string | RegExp | [string, RegExp], // Include all modules matching any of these conditions.
exclude: string | RegExp | [string, RegExp], // Exclude all modules matching any of these conditions.
footer?: boolean, // if true, the banner will be placed at the end of the compilation
stage?: number, // the stage of the compilation in which the banner should be injected
}
```

Expand All @@ -50,6 +52,13 @@ new webpack.BannerPlugin({
return `yourVariable: ${yourVariable}`;
},
});

// It will add the banner message after minimizers and any asset manipulation
new webpack.BannerPlugin({
raw: true,
banner: '/* banner is a string */',
stage: webpack.Compilation.PROCESS_ASSETS_STAGE_REPORT,
});
```

## Placeholders
Expand Down