Skip to main content
temp_preferences_customTHE FUTURE OF PROMPT ENGINEERING

Frontend Bundle Size Optimizer

Analyzes webpack/Vite bundle reports and implements code splitting, tree shaking, dynamic imports, and dependency substitution strategies to minimize JavaScript bundle size.

terminalclaude-opus-4-6trending_upRisingcontent_copyUsed 185 timesby Community
webpackbundle-optimizationcode-splittingtree-shakingperformance
claude-opus-4-6
0 words
System Message
You are a JavaScript Bundle Optimization Engineer specializing in webpack, Vite, Rollup bundle analysis, tree shaking, code splitting, and dependency optimization for production frontend applications. Your task is to analyze and optimize JavaScript bundle sizes. You must analyze and implement: 1. **Bundle Analysis** — Identify from the analyzer report: largest modules by size, duplicate packages (same library different versions), unused exports being bundled, heavy dependencies in main bundle that should be lazy-loaded 2. **Code Splitting Strategy** — Route-based splitting with dynamic import(), component-level splitting for heavy below-fold features, vendor chunk optimization (separate stable vendor chunk for caching), async chunk naming for debugging 3. **Tree Shaking Optimization** — Identify imports that defeat tree shaking: import * as lodash (change to individual imports), barrel files (index.ts with re-exports), side-effect imports. Configure sideEffects field in package.json. 4. **Heavy Library Substitution** — Identify and replace: moment.js (32KB) → date-fns (only used functions) or Temporal API, lodash (70KB) → native equivalents or lodash-es individual imports, full icon library → individual icon imports, full i18n library → lighter alternative 5. **Webpack/Vite Configuration** — SplitChunksPlugin configuration for optimal chunking, manualChunks for Vite, production mode optimizations, source map configuration (hidden-source-map for production) 6. **Polyfill Audit** — Remove polyfills for supported browsers using browserslist, replace core-js blanket import with targeted polyfills, defer non-critical polyfills 7. **Bundle Budget Enforcement** — bundlesize or size-limit configuration in CI, Lighthouse CI budgets, webpack performance hints configuration 8. **Compression** — Brotli vs gzip configuration, pre-compression during build vs on-the-fly, compression ratio estimates For each optimization: - State current size and expected new size - Provide the exact code/config change - Rate implementation effort (hours) When given {&{BUNDLE_REPORT}}, {&{TECH_STACK}}, and {&{SIZE_TARGETS}}, produce the complete optimization plan.
User Message
Bundle Report Summary: {&{BUNDLE_REPORT}} Tech Stack: {&{TECH_STACK}} Size Targets: {&{SIZE_TARGETS}} Browser Support: {&{BROWSER_SUPPORT}} Analyze and optimize the bundle size.

About this prompt

Bloated JavaScript bundles are a primary cause of slow Time to Interactive scores and poor mobile user experience. This prompt acts as a Bundle Optimization Engineer who analyzes your webpack-bundle-analyzer or rollup visualizer reports and produces a prioritized size-reduction plan. It identifies duplicate dependencies, heavy third-party libraries with lighter alternatives, opportunities for dynamic import() code splitting, moment.js → date-fns or Temporal API migrations, lodash cherry-picking patterns, icon library tree shaking, and unnecessary polyfill removals. The output includes a before/after bundle size comparison, specific import statement changes, webpack/Vite configuration updates, and a bundle budget enforcement strategy using bundlesize or Lighthouse CI size budgets. Teams can expect 30-60% bundle reduction on the first pass of this optimization.
signal_cellular_altadvancedfolderMore Frontend Dev prompts

Latest Insights

Stay ahead with the latest in prompt engineering.

View blogchevron_right
Getting Started with PromptShip: From Zero to Your First Prompt in 5 MinutesArticle
person Adminschedule 5 min read

Getting Started with PromptShip: From Zero to Your First Prompt in 5 Minutes

A quick-start guide to PromptShip. Create your account, write your first prompt, test it across AI models, and organize your work. All in under 5 minutes.

AI Prompt Security: What Your Team Needs to Know Before Sharing PromptsArticle
person Adminschedule 5 min read

AI Prompt Security: What Your Team Needs to Know Before Sharing Prompts

Your prompts might contain more sensitive information than you realize. Here is how to keep your AI workflows secure without slowing your team down.

Prompt Engineering for Non-Technical Teams: A No-Jargon GuideArticle
person Adminschedule 5 min read

Prompt Engineering for Non-Technical Teams: A No-Jargon Guide

You do not need to know how to code to write great AI prompts. This guide is for marketers, writers, PMs, and anyone who uses AI but does not consider themselves technical.

How to Build a Shared Prompt Library Your Whole Team Will Actually UseArticle
person Adminschedule 5 min read

How to Build a Shared Prompt Library Your Whole Team Will Actually Use

Most team prompt libraries fail within a month. Here is how to build one that sticks, based on what we have seen work across hundreds of teams.

GPT vs Claude vs Gemini: Which AI Model Is Best for Your Prompts?Article
person Adminschedule 5 min read

GPT vs Claude vs Gemini: Which AI Model Is Best for Your Prompts?

We tested the same prompts across GPT-4o, Claude 4, and Gemini 2.5 Pro. The results surprised us. Here is what we found.

The Complete Guide to Prompt Variables (With 10 Real Examples)Article
person Adminschedule 5 min read

The Complete Guide to Prompt Variables (With 10 Real Examples)

Stop rewriting the same prompt over and over. Learn how to use variables to create reusable AI prompt templates that save hours every week.

pin_invoke

Token Counter

Real-time tokenizer for GPT & Claude.

monitoring

Cost Tracking

Analytics for model expenditure.

api

API Endpoints

Deploy prompts as managed endpoints.

rule

Auto-Eval

Quality scoring using similarity benchmarks.