Title: i18n causes esbuild chunks to be cache-busted on each deploy · Issue #30675 · angular/angular-cli · GitHub
Open Graph Title: i18n causes esbuild chunks to be cache-busted on each deploy · Issue #30675 · angular/angular-cli
X Title: i18n causes esbuild chunks to be cache-busted on each deploy · Issue #30675 · angular/angular-cli
Description: Command build Is this a regression? Yes, this behavior used to work in the previous version The previous version in which this bug was not present was Webpack builder Description Turning on esbuild is causing us to experience a large inc...
Open Graph Description: Command build Is this a regression? Yes, this behavior used to work in the previous version The previous version in which this bug was not present was Webpack builder Description Turning on esbuild...
X Description: Command build Is this a regression? Yes, this behavior used to work in the previous version The previous version in which this bug was not present was Webpack builder Description Turning on esbuild...
Opengraph URL: https://github.com/angular/angular-cli/issues/30675
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"i18n causes esbuild chunks to be cache-busted on each deploy","articleBody":"### Command\n\nbuild\n\n### Is this a regression?\n\n- [x] Yes, this behavior used to work in the previous version\n\n### The previous version in which this bug was not present was\n\nWebpack builder\n\n### Description\n\nTurning on `esbuild` is causing us to experience a large increase in the number of static requests served to our users (+9B requests/mo / +60% increase), leading to a substantial impact on our CDN bill.\n\n\u003cimg width=\"1341\" height=\"530\" alt=\"Image\" src=\"https://github.com/user-attachments/assets/5b64749a-a48b-4dcc-9c10-c50f3833fb4d\" />\n\nEach spike in the graph above aligns with a deploy (no deploys on weekends), indicating that all assets appear to be cache-busted with each new build (whereas in practice only a fraction of the code is updated between versions).\n\nUpon investigating where this could come from, I noticed that chunks with identical content between two build versions have different filename hashes, i.e., `chunk-ASRRVFTX.js` in the first one and `chunk-MO3N5ZQM.js` in the second one:\n\n\u003cimg width=\"1115\" height=\"328\" alt=\"Image\" src=\"https://github.com/user-attachments/assets/c18d4568-f773-4020-95fb-e8d192eb078a\" />\n\u003cimg width=\"1112\" height=\"290\" alt=\"Image\" src=\"https://github.com/user-attachments/assets/6760ae33-aaa6-4c23-a473-4ef474986dd2\" />\n\nIf you look carefully, you can notice that the chunk contents are not exactly identical—they differ by the value of the `i18n:` comment. Looking into it, that `i18n` hash is the same for **all** the chunks (in any locale) across a build and appears to be a SHA256 of all the localized dictionaries.\n\nSince at least a couple of strings are going to change across builds (we have ~14k strings in the app), this effectively means that the entire app is cache-busted on each deploy, leading to increased infrastructure costs and degraded client-side performance.\n\n### Minimal Reproduction\n\nMinimal repro is available here: https://github.com/laurentgoudet/angular-i18n-esbuild-bug\n\nSteps I performed:\n- `ng new`\n- `ng add @angular/localize`\n- Configured an `fr` locale in `angular.json`\n- Added some string in `app.ts`\n- Ran `ng extract-i18n` to extract the dictionary\n- Copied `messages.xlf` to `src/locale/messages.fr.xlf` \n- Ran `ng build --localize` to run the localized build\n\n```\nng build --localize\nInitial chunk files | Names | Raw size | Estimated transfer size\nmain-BGVPYDPI.js | main | 221.57 kB | 61.67 kB\npolyfills-25EJAOGH.js | polyfills | 36.97 kB | 12.41 kB\nstyles-5INURTSO.css | styles | 0 bytes | 0 bytes\n\n | Initial total | 258.54 kB | 74.08 kB\n\nApplication bundle generation complete. [1.794 seconds]\n```\n\n- Observed that `i18n:` hash is the same between `polyfills-\u003cfoo>.js` & `main-\u003cfoo>.js` bundles in both `en-US` & `fr`\n\n```\n$ rg -l i18n:cf2ec5733a24b255a5f4c5407a5cd5747f51614f533bf44f15ae320960b64048 dist \ndist/test-esbuild-i18n/browser/en-US/polyfills-PJEY6MCR.js\ndist/test-esbuild-i18n/browser/fr/polyfills-PJEY6MCR.js\ndist/test-esbuild-i18n/browser/en-US/main-YXPGXXTL.js\ndist/test-esbuild-i18n/browser/fr/main-YXPGXXTL.js\n```\n\n- Add a translation for in the `fr` dictionary (`src/locale/messages.fr.xlf`)\n\n- Run `ng build --localize` again\n\n- Observe that the filename hashes have changed\n\n```\nng build --localize\nInitial chunk files | Names | Raw size | Estimated transfer size\nmain-YXPGXXTL.js | main | 221.57 kB | 61.67 kB\npolyfills-PJEY6MCR.js | polyfills | 36.97 kB | 12.45 kB\nstyles-5INURTSO.css | styles | 0 bytes | 0 bytes\n\n | Initial total | 258.54 kB | 74.13 kB\n\nApplication bundle generation complete. [1.426 seconds]\n```\n\n### Exception or Error\n\n```text\n\n```\n\n### Your Environment\n\n```text\nng version\n\n _ _ ____ _ ___\n / \\ _ __ __ _ _ _| | __ _ _ __ / ___| | |_ _|\n / △ \\ | '_ \\ / _` | | | | |/ _` | '__| | | | | | |\n / ___ \\| | | | (_| | |_| | | (_| | | | |___| |___ | |\n /_/ \\_\\_| |_|\\__, |\\__,_|_|\\__,_|_| \\____|_____|___|\n |___/\n\n\nAngular CLI: 20.0.5\nNode: 22.15.0\nPackage Manager: npm 10.9.2\nOS: darwin arm64\n\nAngular: 20.0.6\n... common, compiler, compiler-cli, core, forms, localize\n... platform-browser, router\n\nPackage Version\n------------------------------------------------------\n@angular-devkit/architect 0.2000.5\n@angular-devkit/core 20.0.5\n@angular-devkit/schematics 20.0.5\n@angular/build 20.0.5\n@angular/cli 20.0.5\n@schematics/angular 20.0.5\nrxjs 7.8.2\ntypescript 5.8.3\nzone.js 0.15.1\n```\n\n### Anything else relevant?\n\n_No response_","author":{"url":"https://github.com/laurentgoudet","@type":"Person","name":"laurentgoudet"},"datePublished":"2025-07-08T19:35:11Z","url":"https://github.com/angular/angular-cli/issues/30675"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:225ec24e-bc53-260d-f3fb-a6f37500b5a2 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9660:1D86C4:365EA80:4526A9F:6B01E845 |
| html-safe-nonce | 3a094d7cb1df8e97d4eb9538ad353d9b1342ba592174515e20ad0d09ce03cda5 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5NjYwOjFEODZDNDozNjVFQTgwOjQ1MjZBOUY6NkIwMUU4NDUiLCJ2aXNpdG9yX2lkIjoiNjAyNjkyOTMyNTc4OTYxNDc3IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 3399ad086d02cf2e5fed1b416b22f7c50b90449ae8f2e832a83f97b331dc2524 |
| hovercard-subject-tag | issue:3213582751 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/angular/angular-cli/30675/issue_layout |
| twitter:image | https://opengraph.githubassets.com/2c9be6eec283e9e483053faca5f0e4fc1e95bb9728a5d7e692791d9dcd9f0468/angular/angular-cli/issues/30675 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/2c9be6eec283e9e483053faca5f0e4fc1e95bb9728a5d7e692791d9dcd9f0468/angular/angular-cli/issues/30675 |
| og:image:alt | Command build Is this a regression? Yes, this behavior used to work in the previous version The previous version in which this bug was not present was Webpack builder Description Turning on esbuild... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | laurentgoudet |
| hostname | github.com |
| expected-hostname | github.com |
| None | cc5dfdd32f62ebd3223cab3af3aa2b268d3605218237326a48a99d1efd89495c |
| turbo-cache-control | no-preview |
| go-import | github.com/angular/angular-cli git https://github.com/angular/angular-cli.git |
| octolytics-dimension-user_id | 139426 |
| octolytics-dimension-user_login | angular |
| octolytics-dimension-repository_id | 36891867 |
| octolytics-dimension-repository_nwo | angular/angular-cli |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 36891867 |
| octolytics-dimension-repository_network_root_nwo | angular/angular-cli |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 8c77c9e8439031ad54c75a250694842892f693e1 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width