api-bundle-size-limit
できること
このスキルは、Webiny APIのビルドのサイズの上限を変えるとき、AIを助けます。バンドルがデフォルトの上限より大きいために、APIのビルドが失敗する開発者向けです。
使う場面
- ✓Webiny APIのビルドが、アセットのサイズ上限のエラーで失敗するとき。
- ✓APIのバンドルが、デフォルトの4.5 MBの上限より大きいとき。
- ✓APIのバンドルに、より厳しいサイズの上限を強制したいとき。
スキルのリンク
https://github.com/webiny/webiny-js/blob/next/skills/user-skills/api-bundle-size-limit/SKILL.mdコピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。
使い方
いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。
貼り付け用メッセージ
Claude Code、Codex、Cursorの場合:プロジェクトのフォルダで実行するとスキルがインストールされます。
SKILL.mdをダウンロードして、エージェントのスキル用フォルダに入れてください。
AIへの頼み方の例
“Webinyのビルドがアセットのサイズ上限のエラーで失敗します。APIバンドルの上限を6 MBに上げてください。”
毎週5つの新しいスキル。1分で読めます。
仕組み
スキルは、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
よくある質問
デフォルトの上限はいくつですか?
APIのLambdaバンドルのデフォルトの上限は4.5 MBです。
設定はどの単位を使いますか?
バイトを使うため、6 MBは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
- ライセンス
- —
- 更新日
- 2026/11/2
コメント
- …
このリポジトリの他のスキル
prd-to-plan
8.1k製品要件書を、それぞれ端から端まで成立する小さなスライスの段階的な計画に変え、Markdownファイルとして保存するよう、エージェントを支援します。
webiny-admin-architect
8.1kビジネスロジックの層とプレゼンターのパターンを使い、Webinyプラットフォームの管理画面を作る方法をエージェントに教えます。
webiny-admin-permissions
8.1k自動生成される権限フォームや、表示・非表示のチェックを含め、Webinyの管理画面に権限の制御を追加するよう、エージェントに教えます。
webiny-form-model
8.1kビルダーで宣言的にフィールドを定義し、レイアウト、検証、条件付きのルールを使って、Webinyのフォームを作るよう、エージェントに教えます。
似ているスキル
api-connector-builder
280kエージェントが既存のパターンに従って、新しいAPI連携を構築します。新しい方式を作らずに、もう一つ連携を追加したいときに使います。
api-design
280kエージェントがベストプラクティスに沿ってREST APIを設計できるようにします。APIの通信方法、エラーの表示方法、データの整理方法を決めるのに役立ちます。
backend-patterns
280kエージェントのサーバーサイドのアーキテクチャパターンとデータベースの最適化を支援します。サーバー上で動くコードを作成またはレビューするときに役立ちます。