wrangler-4-116-0-16-b
Claude Code's read-only tools, web search on, ludion sync off
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
For **bundle size**, run `npx wrangler deploy --dry-run --outdir dist`. It builds the Worker without uploading it and prints the total and gzipped upload size. Add `--metafile` if you want an esbuild metafile; you can load it into a bundle analyzer such as esbuild.github.io/analyze to see which modules take up the most space.
For **startup time**, run `npx wrangler check startup`. It bundles your Worker, profiles its global-scope initialization, and writes a `worker-startup.cpuprofile` file. Open that file in Chrome DevTools (Performance tab) or VS Code to see where startup CPU time goes. You can pass `--worker-bundle` to profile a bundle you've already built.
These commands are from memory and I haven't run them here, so check `npx wrangler --help` against your installed version. `check startup` only exists in fairly recent Wrangler releases.Grade
wrong
The judge's reason: It describes `wrangler check startup` as only writing a CPU profile, the stale behavior, and gets bundle size from a different command instead of saying check startup now reports bundle size and a timing summary.
Session log
Agent
For **bundle size**, run `npx wrangler deploy --dry-run --outdir dist`. It builds the Worker without uploading it and prints the total and gzipped upload size. Add `--metafile` if you want an esbuild metafile; you can load it into a bundle analyzer such as esbuild.github.io/analyze to see which modules take up the most space. For **startup time**, run `npx wrangler check startup`. It bundles your Worker, profiles its global-scope initialization, and writes a `worker-startup.cpuprofile` file. Open that file in Chrome DevTools (Performance tab) or VS Code to see where startup CPU time goes. You can pass `--worker-bundle` to profile a bundle you've already built. These commands are from memory and I haven't run them here, so check `npx wrangler --help` against your installed version. `check startup` only exists in fairly recent Wrangler releases.