wrangler-4-116-0-16-b
Claude Code's read-only tools, web search on, ludion sync on
Question
How can I measure my Worker's startup time and bundle size locally with wrangler?
Answer key
- A correct answer says
- `wrangler check startup` is no longer alpha and reports bundle sizes plus a local timing summary.
- The stale answer
- `wrangler check startup` is an alpha command that only writes a CPU profile.
Answer
Use two wrangler commands:
- **Bundle size:** `npx wrangler deploy --dry-run --outdir dist` builds the Worker without deploying it. It prints the total and gzipped upload size, and writes the bundled output to `dist/` so you can check what's taking up space. Add `--metafile` to get an esbuild metafile, which you can load into a bundle analyzer.
- **Startup time:** `npx wrangler check startup` builds your Worker and profiles its startup locally. It writes a `worker-startup.cpuprofile` file, which you can open in Chrome DevTools (Performance tab) or VS Code to see where time goes during global-scope initialization. Pass `--args` to profile with your usual build flags, or `--worker-bundle` to profile a bundle you've already built.
When you actually deploy, wrangler also prints the measured "Worker Startup Time" next to the upload size. Comparing that number against the local profile is a good sanity check.
I answered from memory and didn't run either command against your installed wrangler 4.148.0. Run `npx wrangler check startup --help` to confirm the flags.Grade
wrong
The judge's reason: It describes `wrangler check startup` as only writing a CPU profile, and relies on `deploy --dry-run` for bundle size, instead of saying `check startup` itself reports bundle sizes and a local timing summary.
Session log
Agent
Use two wrangler commands: - **Bundle size:** `npx wrangler deploy --dry-run --outdir dist` builds the Worker without deploying it. It prints the total and gzipped upload size, and writes the bundled output to `dist/` so you can check what's taking up space. Add `--metafile` to get an esbuild metafile, which you can load into a bundle analyzer. - **Startup time:** `npx wrangler check startup` builds your Worker and profiles its startup locally. It writes a `worker-startup.cpuprofile` file, which you can open in Chrome DevTools (Performance tab) or VS Code to see where time goes during global-scope initialization. Pass `--args` to profile with your usual build flags, or `--worker-bundle` to profile a bundle you've already built. When you actually deploy, wrangler also prints the measured "Worker Startup Time" next to the upload size. Comparing that number against the local profile is a good sanity check. I answered from memory and didn't run either command against your installed wrangler 4.148.0. Run `npx wrangler check startup --help` to confirm the flags.