Loading page...Загружаем страницу...正在加载页面...
AtlasRepo

How I Cut 40KB from My Edge Bundle with Zero-Dep Utils

Description and use

Reduced Cloudflare Workers bundle size from ~40 KB to ~2 KB by replacing heavy dependencies with zero‑dependency utilities, improving cold starts and staying within limits.

Problem

Large bundle size in Cloudflare Workers caused cold start delays and exceeded free tier limits.

Outcome

Reduced bundle size from ~40 KB to ~2 KB, a 95 % reduction, eliminating large dependencies and container usage.

Workflow

  • Identify utilities inflating bundle size.
  • Select or build zero‑dependency replacements.
  • Integrate fetch-retry-jitter for retry logic.
  • Integrate env-assert-typed for environment validation.
  • Replace tj-actions/changed-files with ci-diff-changed in GitHub Actions.
  • Measure bundle size before and after.
  • Publish results and provide starter templates.

Evidence

Every "lightweight" utility pulled in dependencies. zod (1.1 MB), p-retry (7 KB + deps), axios-retry (requires axios).

Source

fetch-retry-jitter (1.6 KB gzip)

Source

env-assert-typed (528 B gzip)

Source

ci-diff-changed (Action, ~80 lines bash)

Source

Total bundle reduction: ~40 KB → ~2 KB (95% reduction)

Source

  • Record date: 2026-11-01T08:14:18.769Z