Skip to content

ng serve / ng build does not work with windows junctions #32306

@fgprioritdev

Description

@fgprioritdev

Command

build, 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

When using the Angular Application Builder (@angular/build:browser) on Windows 11 (or Windows Server 2022), script tags are not injected into index.html if the project is accessed through a Windows junction.

This happens when preserveSymlinks: true is configured and occurs both during ng serve and ng build.

The same project works correctly when:

  • accessed via its real filesystem path (not through a junction), or
  • built using the legacy Webpack builder (@angular-devkit/build-angular:browser).

No errors or warnings are reported during the build or serve process.

This issue is the same as #27119 and is still reproducible with Angular 21.

Expected behavior

  • index.html should contain the injected script tags

Actual behavior

  • index.html is generated without any script tags
  • The page loads as a blank page
  • No CLI errors or warnings are shown
  • The build output otherwise appears successful

Minimal Reproduction

  1. Create a new Angular project:
    ng new junction-repro
    cd junction-repro

  2. Enable symlink preservation:
    add "preserveSymlinks": true in angular.json

  3. Create a Windows junction pointing to the project directory:
    mklink /J C:\temp\junction-repro C:\realpath\junction-repro

  4. Open the project via the junction path:
    cd C:\temp\junction-repro
    ng serve

  5. Open the application in the browser.

see also #27119 for a setup with Dev Drives

Exception or Error

There is no error shown.

Your Environment

Angular CLI       : 21.0.5
Angular           : 21.0.8
Node.js           : 24.11.0
Package Manager   : npm 11.6.1
Operating System  : win32 x64

┌───────────────────────────┬───────────────────┬───────────────────┐
│ Package                   │ Installed Version │ Requested Version │
├───────────────────────────┼───────────────────┼───────────────────┤
│ @angular/build            │ 21.0.5            │ ^21.0.5           │
│ @angular/cli              │ 21.0.5            │ ^21.0.5           │
│ @angular/common           │ 21.0.8            │ ^21.0.0           │
│ @angular/compiler         │ 21.0.8            │ ^21.0.0           │
│ @angular/compiler-cli     │ 21.0.8            │ ^21.0.0           │
│ @angular/core             │ 21.0.8            │ ^21.0.0           │
│ @angular/forms            │ 21.0.8            │ ^21.0.0           │
│ @angular/platform-browser │ 21.0.8            │ ^21.0.0           │
│ @angular/router           │ 21.0.8            │ ^21.0.0           │
│ rxjs                      │ 7.8.2             │ ~7.8.0            │
│ typescript                │ 5.9.3             │ ~5.9.2            │
│ vitest                    │ 4.0.17            │ ^4.0.8            │
└───────────────────────────┴───────────────────┴───────────────────┘

Anything else relevant?

The issue does not occur when:

  • running the same project from its real filesystem path
  • switching to the webpack builder:
    "builder": "@angular-devkit/build-angular:browser"

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions