SuperAPI AI Directory

webpack-plugin-recipes

Frontend & websites

View repository

Updated 10-16 03:46

About this skill

dot-skills Webpack 5 Plugins Best Practices

Cookbook of 26 production-shaped webpack 5 plugins, organized by the problem they solve. Each recipe starts with a clearly defined problem statement ("here's what hurts without this"), shows the naive non-plugin approach, then provides a complete working plugin (60-150 lines) with explanation, variations, and "when NOT to use" guidance.

Companion to webpack-plugin-authoring — authoring teaches how to write any plugin correctly; recipes teach which plugin to write for a specific pain point. Recipes cross-reference the authoring rules they apply.

When to Apply

Reference these recipes whenever:

  • A team has a recurring build-time problem that "feels like it should be a plugin" (architecture rules, secret leak prevention, asset organization)
  • You need to integrate webpack output with downstream systems (SSR servers, CDNs, monitoring)
  • You're considering whether to write your own plugin OR adopt an existing one — these recipes show the underlying pattern so you can judge fit
  • Migrating from another bundler and need to recreate framework-style features (filesystem routing, virtual modules)
  • Onboarding new engineers to webpack plugin authoring — recipes give realistic, end-to-end examples

Recipe Categories by Priority

Priority Category Impact Prefix
1 Build-time Guardrails CRITICAL guard-
2 Build Metadata & Manifests HIGH meta-
3 Virtual Modules & Codegen HIGH virtual-
4 Code Transformation MEDIUM-HIGH transform-
5 Developer Experience MEDIUM dx-
6 Asset Pipeline MEDIUM assets-

Quick Reference

1. Build-time Guardrails (CRITICAL)

2. Build Metadata & Manifests (HIGH)

3. Virtual Modules & Codegen (HIGH)

4. Code Transformation (MEDIUM-HIGH)

5. Developer Experience (MEDIUM)

6. Asset Pipeline (MEDIUM)

How to Use

When the user describes a webpack problem (or asks for a plugin):

  1. Identify the problem category (guardrail? metadata? codegen? transformation? dx? asset?)
  2. Open the matching recipe file — read the Problem section first to confirm it's the right recipe
  3. Use the Plugin section as a working starting point — adapt to the project's specifics
  4. Read How it works for the WHY behind each design choice (cross-references the authoring rules)
  5. Check Variations for common adaptations and When NOT to use to confirm the fit

For learning plugin authoring patterns more broadly, pair with the webpack-plugin-authoring skill — its 44 rules teach the underlying APIs every recipe in this skill applies.

Reference Files

File Description
references/_sections.md Category definitions and impact levels
assets/templates/_template.md Template for authoring new recipes
metadata.json Version and source references