Langsung ke konten
Skillpedia
API & server (backend)8.1k · #12581

api-bundle-size-limit

Fungsinya

Skill ini membantu AI Anda mengubah batas ukuran pada build API Webiny. Skill ini untuk pengembang yang build API-nya gagal karena bundel lebih besar dari batas default.

Kapan dipakai

  • ✓Saat build API Webiny Anda gagal dengan galat batas ukuran aset.
  • ✓Saat bundel API Anda lebih besar dari batas default 4,5 MB.
  • ✓Saat Anda ingin batas ukuran yang lebih ketat diterapkan pada bundel API.

Link skill

https://github.com/webiny/webiny-js/blob/next/skills/user-skills/api-bundle-size-limit/SKILL.md

Salin lalu tempelkan ke AI Anda (Claude, ChatGPT, atau Cursor) dan minta AI mengikuti instruksinya.

Cara pakai

Cara paling mudah: salin pesan ini dan tempelkan ke AI Anda. AI akan membaca skill dan mengikuti instruksinya.

Pesan siap tempel

Gunakan skill ini untuk membantu saya: https://github.com/webiny/webiny-js/blob/next/skills/user-skills/api-bundle-size-limit/SKILL.md Baca file SKILL.md di link tersebut dan ikuti instruksinya untuk tugas saya.
Mau AI Anda menemukan skill seperti ini sendiri?Pasang MCP Skillpedia gratis: cukup satu baris, dan AI mencari di antara 15.000+ skill sebelum tiap tugas.Pasang dalam 1 menit →

Contoh permintaan ke AI

“Build Webiny saya gagal dengan galat batas ukuran aset. Naikkan batas bundel API menjadi 6 MB.”

5 skill baru setiap minggu. 1 menit baca.

Cara kerjanya

Skill menunjukkan cara menambahkan pengaturan dalam berkas konfigurasi Webiny, dengan ukuran ditulis dalam byte. Skill juga menjelaskan cara membaca pesan galat build.

Konten teknis (SKILL.md asli)

Teks asli dari pembuat, dalam bahasa Inggris, langsung dari GitHub.

API Bundle Size Limit

TL;DR

The Infra.Api.MaxBundleSize extension enforces a maximum size on the built API Lambda bundle. The default limit is 4.5 MB. If the bundle exceeds the limit the build fails with a clear error; add the extension to webiny.config.tsx to raise (or lower) it.

Default Behavior

By default Webiny enforces a 4.5 MB limit on the API Lambda bundle (handler.mjs). If the built output exceeds this, the build fails:

error   Build errors:
× asset size limit: The following asset(s) exceed the recommended size limit (4.5 MiB).
× entrypoint size limit: The following entrypoint(s) combined asset size exceeds the recommended limit (4.5 MiB).
error   build failed

Raising the Limit

Add Infra.Api.MaxBundleSize to webiny.config.tsx with size in bytes:

// webiny.config.tsx
import { Infra } from "webiny/extensions";

export const Extensions = () => (
  <>
    {/* Raise the API bundle size limit to 6 MB */}
    <Infra.Api.MaxBundleSize size={6 * 1024 * 1024} />
  </>
);

Common byte values:

MB Bytes expression Exact bytes
4.5 Math.round(4.5 * 1024 * 1024) 4718592 (default)
5 5 * 1024 * 1024 5242880
6 6 * 1024 * 1024 6291456
8 8 * 1024 * 1024 8388608
10 10 * 1024 * 1024 10485760

How It Works

The extension sets the WEBINY_INFRA_API_MAX_BUNDLE_SIZE environment variable (in bytes) which is read by the API bundler (@webiny/build-tools) at build time. The WEBINY_INFRA_ prefix ensures the variable is not automatically forwarded to the Lambda function's runtime environment.

Lowering the Limit

You can also enforce a stricter limit to catch bundle regressions early:

{
  /* Enforce a strict 3 MB limit */
}
<Infra.Api.MaxBundleSize size={3 * 1024 * 1024} />;

Quick Reference

Task Snippet
Raise to 6 MB <Infra.Api.MaxBundleSize size={6 * 1024 * 1024} />
Raise to 10 MB <Infra.Api.MaxBundleSize size={10 * 1024 * 1024} />
Restore default (4.5 MB) Remove the extension
Convert MB to bytes Math.round(N * 1024 * 1024)

Related Skills

  • infra-env-var -- setting arbitrary environment variables in the project context
  • api-lambda-function -- adding custom Lambda functions to the API
Pertanyaan umum

Berapa batas default-nya?

Batas default untuk bundel Lambda API adalah 4,5 MB.

Satuan apa yang dipakai pengaturan ini?

Ia memakai byte, sehingga 6 MB ditulis sebagai 6 kali 1024 kali 1024.

Bisakah saya membuat batasnya lebih ketat?

Bisa. Skill menyatakan Anda dapat menetapkan batas yang lebih rendah untuk menerapkan ukuran yang lebih ketat.

Detail

Deskripsi asli dari pembuat

Covers how to configure the maximum allowed size of the Webiny API Lambda bundle using the Infra.Api.MaxBundleSize extension in webiny.config.tsx. Use when a project's API bundle exceeds the default 4.5 MB limit or when you want to enforce a stricter limit. Handles the extension syntax, byte calculations, and interpreting the build error message.

repo: webiny/webiny-js

Popularitas

Bintang GitHub
8.1k
Peringkat
#12581
Lisensi
—
Diperbarui
2/11/2026

Apakah skill ini berguna?

0

Masuk untuk memberi suara.

Komentar

  • …

Skill lain dari repositori ini

Skill serupa