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

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

Описание и применение

Сокращение размера бандла Edge‑сервиса с ~40 КБ до ~2 КБ за счёт замены тяжёлых зависимостей на нулевые, улучшая холодные старты и соблюдая лимиты.

Задача

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

Результат

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

Рабочий процесс

  • 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.

Доказательства

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

Источник

fetch-retry-jitter (1.6 KB gzip)

Источник

env-assert-typed (528 B gzip)

Источник

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

Источник

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

Источник

  • Дата записи: 2026-11-01T08:14:18.769Z