api-bundle-size-limit
ما الذي تفعله
تساعد هذه المهارة ذكاءك على تغيير حد الحجم لبناء API في Webiny. وهي لمطورين يفشل بناء الـAPI لديهم لأن الحزمة أكبر من الحد الافتراضي.
متى تستخدمها
- ✓عندما يفشل بناء Webiny API مع خطأ في حد حجم الأصول.
- ✓عندما تكون حزمة الـAPI أكبر من الحد الافتراضي البالغ 4.5 ميغابايت.
- ✓عندما تريد فرض حد أصغر لحجم حزمة الـAPI.
رابط المهارة
https://github.com/webiny/webiny-js/blob/next/skills/user-skills/api-bundle-size-limit/SKILL.mdانسخه والصقه في الذكاء الاصطناعي الذي تستخدمه (Claude أو ChatGPT أو Cursor) واطلب منه اتباع التعليمات.
طريقة الاستخدام
أسهل طريقة: انسخ الرسالة والصقها في الذكاء الاصطناعي الذي تستخدمه. سيقرأ المهارة وينفّذ تعليماتها.
رسالة جاهزة للصق
لـ Claude Code أو Codex أو Cursor: شغّله داخل مجلد مشروعك وستُثبَّت المهارة.
نزّل ملف SKILL.md وضعه في مجلد مهارات وكيلك.
مثال على ما تطلبه من الذكاء الاصطناعي
“يفشل بناء Webiny لدي مع خطأ في حد حجم الأصول. ارفع حد حزمة الـAPI إلى 6 ميغابايت.”
5 مهارات جديدة كل أسبوع. قراءة في دقيقة واحدة.
كيف تعمل
تُظهر المهارة كيفية إضافة إعداد في ملف إعدادات Webiny، يُكتب فيه الحجم بالبايت. وتشرح أيضًا كيفية قراءة رسالة خطأ البناء.
المحتوى التقني (ملف SKILL.md الأصلي)
النص الأصلي من المؤلف، مباشرة من 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 contextapi-lambda-function-- adding custom Lambda functions to the API
الأسئلة الشائعة
ما الحد الافتراضي؟
الحد الافتراضي لحزمة Lambda الخاصة بالـAPI هو 4.5 ميغابايت.
بأي وحدة يُكتب الإعداد؟
بالبايت، فيُكتب 6 ميغابايت على أنه 6 مضروبًا في 1024 مضروبًا في 1024.
هل أستطيع جعل الحد أكثر صرامة؟
نعم. تقول المهارة إنه يمكنك ضبط حد أصغر لفرض حجم أكثر صرامة.
التفاصيل
الوصف الأصلي من المؤلف
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
الشعبية
- نجوم GitHub
- 8.1k
- الترتيب
- #12581
- الترخيص
- —
- آخر تحديث
- 2/11/2026
التعليقات
- …
المزيد من المهارات من هذا المستودع
prd-to-plan
8.1kيساعد وكيلك على تحويل وثيقة متطلبات منتج إلى خطة مرحلية من شرائح صغيرة متكاملة من البداية إلى النهاية، تُحفظ كملف Markdown.
webiny-admin-architect
8.1kيعلّم وكيلك بناء شاشات الإدارة لمنصة Webiny، باستخدام طبقات منطق العمل وأسلوب الـpresenter.
webiny-admin-permissions
8.1kيعلّم وكيلك إضافة ضوابط الصلاحيات إلى شاشات إدارة Webiny، مع نماذج صلاحيات مولَّدة تلقائيًا وفحوص لإظهار الأجزاء أو إخفائها.
webiny-form-model
8.1kيعلّم وكيلك بناء النماذج في Webiny باستخدام منشئ حقول تصريحي، مع التخطيطات والتحقق والقواعد الشرطية.
مهارات مشابهة
api-connector-builder
280kيبني وكيلك اتصالات API جديدة على النمط الموجود، ويفيد عندما تحتاج إلى تكامل إضافي دون ابتكار طريقة جديدة للعمل.
api-design
280kيساعد وكيلك على تصميم واجهات REST API وفق أفضل الممارسات، ويوضح كيف تتواصل وكيف تُعرض الأخطاء وكيف تُنظَّم البيانات.
backend-patterns
280kيساعد وكيلك على أنماط بنية الخادم وتحسين قاعدة البيانات، ويفيد في بناء الشيفرة التي تعمل على الخادم أو مراجعتها.