Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

HMR breaks if project contains enum called "URL" #61517

Copy link
Copy link
@Marax

Description

@Marax
Issue body actions

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

18

Description

When project contains enum URL (capital letters) application fails to start with error
"Uncaught TypeError: URL is not a constructor"
This will fail:

import {Component} from '@angular/core';
import {RouterOutlet} from '@angular/router';

export enum URL {
  MY = 'MY'
}

@Component({
  selector: 'app-root',
  imports: [RouterOutlet],
  templateUrl: './app.component.html',
  styleUrl: './app.component.scss'
})
export class AppComponent {
  title = 'hmr-test';
}

Renaming URL to Url or setting hmr: false solves the issue.

Minimal Reproduction

  1. create new app using version 19
  2. open app.component.ts and add:
    export enum URL { MY = 'MY' }
  3. run ng server
  4. see aplication failing to run

Exception or Error

"Uncaught TypeError: URL is not a constructor"

Your Environment

Angular CLI: 19.2.12
Node: 22.11.0
Package Manager: npm 10.8.2
OS: win32 x64

Angular: 19.2.11
... common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1902.12
@angular-devkit/build-angular   19.2.12
@angular-devkit/core            19.2.12
@angular-devkit/schematics      19.2.12
@angular/cli                    19.2.12
@schematics/angular             19.2.12
rxjs                            7.8.2
typescript                      5.7.3
zone.js                         0.15.0

Anything else relevant?

No response

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions

    Morty Proxy This is a proxified and sanitized view of the page, visit original site.