Repository navigation
Description
Command
serve
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
No response
Description
I would like to request a backport of #33525 to the Angular 21 branch.
The issue affects ng serve --configuration=production when externalDependencies are used and the generated code is optimized/minified. The angular-plugin-remove-id-prefix Vite plugin currently uses a greedy regex:
(?:/.+)?
When the generated code is minified into a single line and an external dependency has a deep import path (for example @angular/common/http), the regex can consume the remainder of the line. As a result, subsequent /@id/ prefixes are not stripped.
The browser then requests URLs such as:
/@id/@angular/router
The Angular dev server responds with the application's index.html fallback, resulting in:
Error: Unsupported Content-Type "text/html" loading http://localhost:4200/@id/@angular/core
The issue has already been fixed upstream changing the regular expression in:
Importantly, the PR explicitly states that the fix was verified end-to-end with @angular/build 21.2.0 by applying the change directly to node_modules in a real application.
Minimal Reproduction
A complete minimal reproduction is already available in the original issue:
-
Issue dev-server: /@id/ prefix not stripped from minified bundles when using externalDependencies (greedy regex in createRemoveIdPrefixPlugin) #33524:
-
Fix: PR #33525
Exception or Error
Error: Unsupported Content-Type "text/html" loading http://localhost:4200/@id/@angular/core
Your Environment
Angular CLI : 21.2.24
Angular : 21.2.23
Node.js : 24.16.0
Package Manager : npm 11.13.0
Operating System : win32 x64
┌───────────────────────────────────┬───────────────────┬───────────────────┐
│ Package │ Installed Version │ Requested Version │
├───────────────────────────────────┼───────────────────┼───────────────────┤
│ @angular/build │ 21.2.24 │ ~21.2.11 │
│ @angular/cdk │ 21.2.14 │ ~21.2.11 │
│ @angular/cli │ 21.2.24 │ ~21.2.11 │
│ @angular/common │ 21.2.23 │ ~21.2.11 │
│ @angular/compiler │ 21.2.23 │ ~21.2.11 │
│ @angular/compiler-cli │ 21.2.23 │ ~21.2.11 │
│ @angular/core │ 21.2.23 │ ~21.2.11 │
│ @angular/forms │ 21.2.23 │ ~21.2.11 │
│ @angular/platform-browser │ 21.2.23 │ ~21.2.11 │
│ @angular/router │ 21.2.23 │ ~21.2.11 │
│ ng-packagr │ 21.2.7 │ ^21.0.0 │
│ rxjs │ 7.8.2 │ ~7.8.2 │
│ typescript │ 5.9.3 │ ~5.9.0 │
│ zone.js │ 0.16.3 │ ~0.16.2 │
└───────────────────────────────────┴───────────────────┴───────────────────┘
Anything else relevant?
No response
Activity
alan-agius4 commentedon Sep 22, 2026
Version 21 is currently in Long-Term Support (LTS) and receives only security-related updates. Because this is not a security issue, it does not qualify for a backport.
angular-automatic-lock-bot commentedon Oct 23, 2026
This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.