René's URL Explorer Experiment


Title: Chunk optimizer assigns the same identifier to an external `@angular/core` namespace import and a class in the same chunk → "ɵɵdefineComponent is not a function" · Issue #33583 · angular/angular-cli · GitHub

Open Graph Title: Chunk optimizer assigns the same identifier to an external `@angular/core` namespace import and a class in the same chunk → "ɵɵdefineComponent is not a function" · Issue #33583 · angular/angular-cli

X Title: Chunk optimizer assigns the same identifier to an external `@angular/core` namespace import and a class in the same chunk → "ɵɵdefineComponent is not a function" · Issue #33583 · 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 Angular 21 (@angular/build 21.x) — the same app built and ran correctly before the upg...

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 Angular 21 (@angular/build 21.x) — the same ap...

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 Angular 21 (@angular/build 21.x) — the same ap...

Opengraph URL: https://github.com/angular/angular-cli/issues/33583

X: @github

direct link

Domain: Github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":" Chunk optimizer assigns the same identifier to an external `@angular/core` namespace import and a class in the same chunk → \"ɵɵdefineComponent is not a function\"","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\nAngular 21 (@angular/build 21.x) — the same app built and ran correctly before the upgrade to Angular 22\n\n### Description\n\nWith `@angular/build`'s default chunk-optimization pass (`NG_BUILD_OPTIMIZE_CHUNKS`, threshold 3), a production build of a large app that **externalizes `@angular/core`** (as Angular Native      \n  Federation does for singleton sharing) produces chunks where the optimizer's renamer assigns the **same minified identifier `e`** to BOTH the external `@angular/core` namespace import AND a      \n  component's named class expression in the same chunk. The class-expression name shadows the namespace inside the class body, so the static initializer calls `\u003cclass\u003e.ɵɵdefineComponent(...)`,     \n  which is `undefined` → `TypeError` at bootstrap → blank white page.                                                                                                                                \n                                                                                                                                                                                                     \n  ### Exact mechanism (compiled output)                                                                                                                                                              \n                                                                                                                                                                                                     \n  ```js                                                                                                                                                                                              \n  import * as e from '@angular/core';                 // external namespace import → minified to \"e\"                                                                                                 \n  let e$1 = class e {                                  // class-expression name → ALSO minified to \"e\"                                                                                               \n    static ɵfac = (o) =\u003e new (o || e)();               // e = the class (self-ref, correct)                                                                                                          \n    static ɵcmp = e.ɵɵdefineComponent({ type: e });    // e.ɵɵdefineComponent: e = the class (WRONG — must be @angular/core)                                                                         \n  };                                                                                                                                                                                                 \n  ```                                                                                                                                                                                                \n                                                                                                                                                                                                     \n  Correct (non-optimized) output uses distinct names: `import * as i0 from '@angular/core'` + `i0.ɵɵdefineComponent({ type: _MyComponent })`.                                                        \n                                                                                                                                                                                                     \n  ### It is specifically the identifier `e`                                                                                                                                                          \n                                                                                                                                                                                                     \n  Measured on one real build (~130 lazy chunks importing the `@angular/core` namespace):                                                                                                             \n                                                                                                                                                                                                     \n  | `@angular/core` namespace minified to… | chunks | of which collide |                                                                                                                             \n  |---|---|---|                                                                                                                                                                                      \n  | `e` | 52 | 5 |                                                                                                                                                                                   \n  | any other letter (t, n, a, i, o, r, s, …) | ~78 | 0 |                                                                                                                                            \n                                                                                                                                                                                                     \n  `namespace=e` + class=`t` → fine; `namespace=o` + class=`e` → fine; only `namespace=e` + class=`e` collides. The renamer fails to deduplicate only for the letter `e`, and only when both a kept   \n  external namespace import and a class-expression name in the same chunk land on it. Colliding components share no source pattern — it is purely a renamer name-allocation collision.               \n                                                                                                                                                                                                     \n  Same class of defect as the closed angular/angular-cli#32764 → rolldown/rolldown#8793 (\"colliding variable names\"), but still reproduces on `rolldown@1.0.3` as bundled by `@angular/build@22.0.x`.\n                                                                                                                                                                                                        \n  **Workaround:** \n- `NG_BUILD_OPTIMIZE_CHUNKS=0` — disables only the chunk-optimization pass; keeps mangling + other minification (main bundle ~126 kB vs ~129 kB).                                                  \n- `NG_BUILD_MANGLE=0` — keeps full identifier names, so the namespace stays `i0` and never collides.       \n\n### Minimal Reproduction\n\n A minimal synthetic reproduction could not be constructed, and the reason is diagnostic: the collision only occurs when the renamer's GLOBAL name-frequency allocation over a large, diverse module\n  graph happens to place the identifier `e` on both a kept external `@angular/core` namespace import and a class-expression name in the same chunk. In uniform synthetic apps (Native Federation +   \n  optimizer, up to ~240 lazy chunks, even with ~35 imports per component and many `e`-namespace chunks), classes are allocated other letters (a/n/o/i) and never collide with the `e` namespace.     \n                                                                                                                                                                                                     \n  It reproduces reliably in a large Angular Native Federation **host** shell (~130 lazy chunks from ~270 diverse compiled components). Extensive bisection ruled out: federation infrastructure      \n  (orchestrator, `@module-federation/enhanced`, `share`/`sharedMappings` config), the eager provider graph, the shared component library (an isolated MFE with 88 shared components at 157 chunks    \n  does NOT collide), specific dependencies, `experimentalDecorators`, `@angular/build`/`esbuild`/native-federation versions, and raw chunk count. Two independent parts of the app each push it over \n  the threshold, confirming an emergent renamer-allocation effect rather than a single module.                                                                                                                                                                                                                                                                                         \n\n### Exception or Error\n\n```text\nERROR TypeError: e.ɵɵdefineComponent is not a function                                                                                                                                                    \n      at \u003cstatic_initializer\u003e (https://.../chunk-XXXXXXXX.js:1:4257)                                                                                                                                        \n      at https://.../chunk-XXXXXXXX.js                                                                                                                                                                      \n      at https://.../main-XXXXXXXX.js                                                                                                                                                                       \n  (thrown from runInitializers → the application never bootstraps → blank page)\n```\n\n### Your Environment\n\n```text\nAngular CLI: 22.0.3                                                                                                                                                                                       \n  Node: 22.x                                                                                                                                                                                                \n  Package Manager: pnpm 10.10                                                                                                                                                                               \n  OS: darwin arm64                                                                                                                                                                                          \n                                                                                                                                                                                                            \n  Angular: 22.0.2                                                                                                                                                                                           \n  ... @angular/build            22.0.3                                                                                                                                                                      \n  ... @angular-devkit/*         22.0.3                                                                                                                                                                      \n                                                                                                                                                                                                            \n  Additional:                                                                                                                                                                                               \n    @angular-architects/native-federation   22.0.5                                                                                                                                                          \n    @softarc/native-federation               4.3.1                                                                                                                                                          \n    rolldown (transitive via @angular/build) 1.0.3                                                                                                                                                          \n    Nx                                       23.1.0                                                                                                                                                         \n    TypeScript                               6.0.3\n```\n\n### Anything else relevant?\n\n  - `chunk-optimizer.js` is byte-identical between `@angular/build` 22.0.3 and 22.0.7.                                                                                                               \n  - Forcing `esbuild@0.28.0` (vs 0.28.1) via a package-manager override does not change anything.                                                                                                    \n  - Bumping `@angular-architects/native-federation` (22.0.1 → 22.0.5) does not change anything.                                                                                                      \n  - References: angular/angular-cli#32764, rolldown/rolldown#8793.","author":{"url":"https://github.com/ChristianLoosliVGT","@type":"Person","name":"ChristianLoosliVGT"},"datePublished":"2026-07-16T10:00:10.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/33583/angular-cli/issues/33583"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:67468c07-659c-a7b2-9e1c-6e31678f4183
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idA4F2:1D457B:7578AF:A0326D:6A627D04
html-safe-noncec0fac4962aae23ebe02d2107c32e305059fe89b6bdceea6dbcd670d6746e6004
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBNEYyOjFENDU3Qjo3NTc4QUY6QTAzMjZEOjZBNjI3RDA0IiwidmlzaXRvcl9pZCI6IjUwOTY3MTgxMjQzNTM0ODYwODUiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmac2d70baa531e43dd16cc5c2ffa95be5ff178d2dbd9e2d57cf5712ba92c87c2d95
hovercard-subject-tagissue:4900872721
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/angular/angular-cli/33583/issue_layout
twitter:imagehttps://opengraph.githubassets.com/f9394e1ab3c77a3694a117d529a81205a30c9512783bf4e90baf89b30b789ffe/angular/angular-cli/issues/33583
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/f9394e1ab3c77a3694a117d529a81205a30c9512783bf4e90baf89b30b789ffe/angular/angular-cli/issues/33583
og:image:altCommand 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 Angular 21 (@angular/build 21.x) — the same ap...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameChristianLoosliVGT
hostnamegithub.com
expected-hostnamegithub.com
None54d77223ecd96549586d00f1e91ee7d05feebf27ea430279a9c4ba4b7de1a93c
turbo-cache-controlno-preview
go-importgithub.com/angular/angular-cli git https://github.com/angular/angular-cli.git
octolytics-dimension-user_id139426
octolytics-dimension-user_loginangular
octolytics-dimension-repository_id36891867
octolytics-dimension-repository_nwoangular/angular-cli
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id36891867
octolytics-dimension-repository_network_root_nwoangular/angular-cli
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release4d79f1b99472a521fc5fb66e9fdc3ce742937dff
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://Github.com/angular/angular-cli/issues/33583#start-of-content
https://Github.com/
Sign in https://Github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fangular%2Fangular-cli%2Fissues%2F33583
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub Copilot appDirect agents from issue to mergehttps://github.com/features/ai/github-app
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
Code QualityEnforce quality at mergehttps://github.com/features/code-quality
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
View all resourceshttps://github.com/resources
GitHub SponsorsFund open source developershttps://github.com/open-source/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/open-source/accelerator
GitHub Starshttps://stars.github.com
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://Github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fangular%2Fangular-cli%2Fissues%2F33583
Sign up https://Github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=angular%2Fangular-cli
Reloadhttps://Github.com/angular/angular-cli/issues/33583
Reloadhttps://Github.com/angular/angular-cli/issues/33583
Reloadhttps://Github.com/angular/angular-cli/issues/33583
Please reload this pagehttps://Github.com/angular/angular-cli/issues/33583
angular https://Github.com/angular
angular-clihttps://Github.com/angular/angular-cli
Notifications https://Github.com/login?return_to=%2Fangular%2Fangular-cli
Fork 11.9k https://Github.com/login?return_to=%2Fangular%2Fangular-cli
Star 27k https://Github.com/login?return_to=%2Fangular%2Fangular-cli
Code https://Github.com/angular/angular-cli
Issues 269 https://Github.com/angular/angular-cli/issues
Pull requests 29 https://Github.com/angular/angular-cli/pulls
Actions https://Github.com/angular/angular-cli/actions
Security and quality 5 https://Github.com/angular/angular-cli/security
Insights https://Github.com/angular/angular-cli/pulse
Code https://Github.com/angular/angular-cli
Issues https://Github.com/angular/angular-cli/issues
Pull requests https://Github.com/angular/angular-cli/pulls
Actions https://Github.com/angular/angular-cli/actions
Security and quality https://Github.com/angular/angular-cli/security
Insights https://Github.com/angular/angular-cli/pulse
Chunk optimizer assigns the same identifier to an external @angular/core namespace import and a class in the same chunk → "ɵɵdefineComponent is not a function"https://Github.com/angular/angular-cli/issues/33583#top
area: @angular/buildhttps://github.com/angular/angular-cli/issues?q=state%3Aopen%20label%3A%22area%3A%20%40angular%2Fbuild%22
gemini-triagedLabel noting that an issue has been triaged by geminihttps://github.com/angular/angular-cli/issues?q=state%3Aopen%20label%3A%22gemini-triaged%22
needsTriagehttps://github.com/angular/angular-cli/milestone/11
https://github.com/ChristianLoosliVGT
ChristianLoosliVGThttps://github.com/ChristianLoosliVGT
on Jul 16, 2026https://github.com/angular/angular-cli/issues/33583#issue-4900872721
#32764https://github.com/angular/angular-cli/issues/32764
rolldown/rolldown#8793https://github.com/rolldown/rolldown/issues/8793
NG_BUILD_OPTIMIZE_CHUNKS can cause variable name collisions #32764https://github.com/angular/angular-cli/issues/32764
[Bug]: colliding variable names rolldown/rolldown#8793https://github.com/rolldown/rolldown/issues/8793
area: @angular/buildhttps://github.com/angular/angular-cli/issues?q=state%3Aopen%20label%3A%22area%3A%20%40angular%2Fbuild%22
gemini-triagedLabel noting that an issue has been triaged by geminihttps://github.com/angular/angular-cli/issues?q=state%3Aopen%20label%3A%22gemini-triaged%22
needsTriageNo due datehttps://github.com/angular/angular-cli/milestone/11
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.