About webpack-plugin-recipes
A cookbook skill for choosing and adapting webpack 5 plugins to recurring build problems. It provides 26 complete recipes with explanations, variations, and guidance on when not to use each pattern.
Key features
- 0126 webpack 5 plugin recipes
- 02Six problem-focused categories
- 03Complete working plugin examples
- 04Explanations and variations
- 05Guidance on when not to use
Use cases
- 01Adding build-time checks for imports or secrets
- 02Generating manifests or virtual modules
- 03Adapting webpack output for downstream systems
- 04Learning practical plugin patterns
Install
Copy the command and run it in a terminal.
npx skills add https:/ / github.com/ pproenca/ dot-skills --skill webpack-plugin-recipesAfter installing, type/webpack-plugin-recipesin Claude Code to confirm it loaded.
Bundled files
References and scripts installed along with SKILL.md.
AGENTS.mdmetadata.jsonassets/templates/_template.mdreferences/_sections.mdassets-add-cache-busting-query.mdassets-optimize-images.mdassets-pre-compress-gzip-brotli.mdassets-route-by-type.mdassets-skip-empty-chunks.mddx-build-duration-report.mddx-diff-changed-chunks.mddx-notify-on-done.mddx-open-browser-on-first-build.mdguard-bundle-budget.mdguard-forbidden-imports.mdguard-no-secrets-bundled.mdguard-required-env-vars.mdmeta-asset-manifest.mdmeta-inject-build-info.mdmeta-license-notice.mdmeta-sri-manifest.mdtransform-banner-with-dynamic-content.mdtransform-conditional-polyfill.mdtransform-define-from-config.mdtransform-replace-library.mdtransform-strip-debug-helpers.mdvirtual-barrel-from-directory.mdvirtual-module-from-memory.mdvirtual-routes-from-filesystem.mdvirtual-types-from-runtime.mdDetails
From the project READMEdot-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)
guard-bundle-budget— Fail builds when initial JS exceeds a per-entry gzipped budgetguard-forbidden-imports— Fail builds when forbidden imports cross architectural boundariesguard-required-env-vars— Fail builds when required environment variables are missingguard-no-secrets-bundled— Fail builds when secret-shaped strings leak into client bundles
2. Build Metadata & Manifests (HIGH)
meta-inject-build-info— Inject__COMMIT__/__BUILD_TIME__into source via DefinePlugin + emitbuild-info.jsonmeta-asset-manifest— Emit chunk-grouped manifest mapping logical names → hashed filenamesmeta-license-notice— GenerateLICENSES.txtby walking the module graph (notnode_modules/)meta-sri-manifest— Compute SHA-384 SRI hashes per asset for CSP compliance
3. Virtual Modules & Codegen (HIGH)
virtual-module-from-memory— Resolvevirtual:Ximports to in-memory strings (Vite-style)virtual-routes-from-filesystem— Generate route map frompages/directory (Next.js-style)virtual-barrel-from-directory— Auto-generate barrel re-exports from a directoryvirtual-types-from-runtime— Emit.d.tsfrom runtime data (config files, JSON schemas)
4. Code Transformation (MEDIUM-HIGH)
transform-replace-library— Replacereactwithpreact/compatat resolve (with subpath handling)transform-strip-debug-helpers— StripdevAssert()/devLog()calls + dev-only imports from productiontransform-conditional-polyfill— Inject only the polyfills target browsers actually need (browserslist + core-js-compat)transform-banner-with-dynamic-content— Per-chunk banners with current year, version, git committransform-define-from-config— DriveDefinePluginsubstitutions from aflags/staging.json-style file
5. Developer Experience (MEDIUM)
dx-build-duration-report— Persist build durations, warn when current build is >30% slower than mediandx-notify-on-done— Desktop notification (local) + Slack webhook (CI) on build completedx-diff-changed-chunks— Print only the chunks that actually changed between rebuildsdx-open-browser-on-first-build— Open the dev-server URL AFTER first successful build (not before)
6. Asset Pipeline (MEDIUM)
assets-pre-compress-gzip-brotli— Emit.gz/.brsiblings for CDN-served pre-compressionassets-optimize-images— Optimize PNG/JPEG with imagemin + cache reuse across rebuildsassets-route-by-type— Organize emitted assets intojs//css//img//fonts/subdirectoriesassets-skip-empty-chunks— Delete the 0-byte chunks webpack/splitChunks/mini-css emit unnecessarilyassets-add-cache-busting-query— Append?v=<hash>to references of fixed-name assets (manifest.json, sw.js)
How to Use
When the user describes a webpack problem (or asks for a plugin):
- Identify the problem category (guardrail? metadata? codegen? transformation? dx? asset?)
- Open the matching recipe file — read the Problem section first to confirm it's the right recipe
- Use the Plugin section as a working starting point — adapt to the project's specifics
- Read How it works for the WHY behind each design choice (cross-references the authoring rules)
- 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 |