Skip to content

NullInjectorError error when building app for Safari >= 14.5 and webpack based builder #30779

@guillaume-moreau

Description

@guillaume-moreau

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

18.2

Description

We got an app that still use the @angular-devkit/build-angular:browser builder and needs support for Safari >= 14.5.

After building to Angular 19 we got a runtime NullInjectorError: No provider for vt! error on build (only occurs whith optimization: true configuration).

The issue seems to be close to this one: #29145

Minimal Reproduction

I've created a repro:
https://github.com/guillaume-moreau/angular-bug

What I did:

On master:

  • ng new my-project
  • Add bowserlist with iOS >= 14.5
  • Optimization true in angular.json configurations/development (for testing purpose, the issue only appear with optimization true)
    ng serve works OK

On feature/bug

  • Move to @angular-devkit/build-angular:browser

ng serve is now KO

Exception or Error

NullInjectorError: R3InjectorError[t -> vt -> vt]: 
  NullInjectorError: No provider for vt!

Your Environment

Angular CLI: 19.2.15
Node: 20.11.1
Package Manager: npm 10.2.4
OS: win32 x64

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

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1902.15
@angular-devkit/build-angular   19.2.15
@angular-devkit/core            19.2.15
@angular-devkit/schematics      19.2.15
@angular/cli                    19.2.15
@schematics/angular             19.2.15
rxjs                            7.8.2
typescript                      5.7.3
zone.js                         0.15.1

Anything else relevant?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions