---
name: webpack-config-analyzer
description: "Explains an existing webpack configuration in plain terms: what each entry builds, where output goes, which loader handles which files, what every plugin does, and how optimization splits the bundles. Use when you inherited a webpack config and need to understand what each entry, loader, plugin, and optimization setting actually does. Do not use for writing a new webpack config from scratch or diagnosing a build that fails or runs slowly. Related topics: coding, webpack."
---

# Webpack Config Analyzer

Explains an existing webpack configuration in plain terms: what each entry builds, where output goes, which loader handles which files, what every plugin does, and how optimization splits the bundles.

## When to use

Use this skill when you inherited a webpack config and need to understand what each entry, loader, plugin, and optimization setting actually does. Do not use it for writing a new webpack config from scratch or diagnosing a build that fails or runs slowly.

## Workflow

1. Ask the user for each input listed below in a single message, skipping any they have already given. Where options are listed, offer them, but accept other answers too.
2. Resolve the effective config for the chosen environment by evaluating function forms, merges, and webpack defaults.
3. Describe each requested section in build order: what each entry produces, the resolved output names, each loader rule with run order, each plugin's effect.
4. Explain the chunks that optimization and splitChunks create and what devServer proxies or hot-reloads.
5. Flag surprises such as missing minification in production, leaking source maps, or rules that never match.
6. Fill the summary table and keep each section at the chosen depth.

## Inputs

- **Config source** (longer free text)
- **Config file path** (free text, e.g. "build/webpack.prod.js")
- **Target environment** (choose one: development, production, test)
- **Explain source maps** (choose one: Yes, No)
- **Sections to cover** (choose any: entry, output, loaders, plugins, resolve, optimization, devServer)
- **Depth** (choose one: Overview, Standard, Every option)

## Output

A markdown document with a summary table, one heading per requested section with bullet points, and a closing Watch Out list.

## Prompt template

Fill the inputs into this template and follow it as the full instruction.

### Webpack Config Analyzer

Explain the webpack configuration below so an engineer new to the project understands the build.

- Config source: {{Config source}}
- Config file path: {{Config file path}}
- Target environment: {{Target environment}}
- Explain source maps: {{Explain source maps}}
- Sections to cover: {{Sections to cover}}
- Depth: {{Depth}}

Resolve the config first: evaluate the function form with the chosen environment, follow merge or spread calls, and apply webpack's defaults for anything unset so the explanation describes what actually runs. Then describe each requested section in build order. For entry, say what each entry point produces. For output, give the resulting file names with hashes resolved to their pattern. For loaders, list each rule as "files matching X go through loaders Y in order Z" and note the order loaders run (last to first). For plugins, state what each one does to the build in one line and which options change its behaviour. For optimization, explain which chunks splitChunks creates and why. For devServer, say what proxies and hot reload are set.

Flag anything surprising as you go: a production config without minification, source maps that leak sources, or a loader rule that never matches. Keep the depth the user chose: Overview is a paragraph per section, Every option walks each key.

### Output
Return a markdown document with a summary table (mode, target, entry points, output path, source maps) followed by one heading per requested section with bullet points, and a final Watch Out list of anything surprising.

## Pitfalls

- Describing the config file as written instead of the effective config, missing defaults and merged overrides that change the build.
- Listing loaders in a rule in the order they appear, when webpack runs them last to first.
- Explaining what a plugin is in general rather than what its options do in this build.
