Group
  • Performance

    Shrink my JavaScript bundle

    Analyze what's in the bundle, evict the squatters, and split what's left so browsers download less code.

    • Improve quality
    • Debug & fix
    • Intermediate
    • General

Free Prompt

My JavaScript bundle is probably full of things my app doesn't need. I want it analyzed and shrunk. First, run a bundle analysis (webpack-bundle-analyzer, source-map-explorer, or whatever fits my build; if my platform hides the build, analyze my imports statically). Show me the largest contributors by size. Then attack the usual suspects: 1. Full-library imports where only one function is used (all of lodash for one debounce, an entire icon set for five icons, a full date library for one format call). Replace with targeted imports or small native alternatives where behavior stays identical. 2. Duplicate dependencies: the same library in multiple versions. Deduplicate via the package manager or import alignment. 3. Dead code: dependencies listed in package.json that nothing imports anymore. Verify with a search before removing, then remove. 4. Client-only vs shared code: make sure server-only code (database clients, secret-bearing modules) isn't being bundled into client JavaScript. If any is, that's both bloat and a security issue; flag it loudly. 5. Code splitting: split heavy, rarely used features out of the main bundle so they load on demand. Don't swap libraries for different libraries wholesale and don't refactor working code for marginal gains. The goal is removing and splitting, not redecorating. When done, report bundle size before and after, itemized by change.

What This Does / How This Helps

This analyzes your JavaScript bundle and shrinks it: targeted imports instead of whole libraries, dedupe, dead dependency removal, and splitting rarely used features out of the main payload. JavaScript is doubly expensive: bytes to download, then parse and execute time on the phone in your user's pocket. AI tools import entire libraries for single utilities constantly, and generated apps drift toward shipping server code to the client, which is a secret-leak risk on top of the bloat. A bundle audit is one of the few performance tasks where an hour of work shows up clearly in the numbers.

Want to skip doing this by hand?

Fortivibe audits your app for all of the areas these prompts cover (and more).

See What We Check

Related Prompts