Skip to content

Angular Linker fails for 'PlatformLocation' with Yarn Berry PnP, requiring JIT compiler #30385

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
laxsuryavanshi opened this issue May 24, 2025 · 0 comments
Labels

Comments

@laxsuryavanshi
Copy link

Which @angular/* package(s) are the source of the bug?

Don't known / other

Is this a regression?

No

Description

When building an Angular application using Yarn Berry with Plug'n'Play (PnP) enabled, I encounter an error indicating that the PlatformLocation injectable needs to be compiled using the JIT compiler because @angular/compiler is not available.

I am looking for a solution that allows us to continue using Yarn PnP without resorting to including @angular/compiler in the production build or disabling PnP.

Steps to reproduce the issue

  • ng new trackr --prefix trackr --routing --server-routing --skip-install --ssr --strict --style scss --package-manager yarn
  • Set "packageManager": "[email protected]" in package.json
  • yarn install
  • yarn build

Please provide a link to a minimal reproduction of the bug

https://github.com/laxsuryavanshi/ybng

Please provide the exception or error you saw

Application bundle generation failed. [4.326 seconds]

✘ [ERROR] An error occurred while extracting routes.

The injectable 'PlatformLocation' needs to be compiled using the JIT compiler, but '@angular/compiler' is not available.

The injectable is part of a library that has been partially compiled.
However, the Angular Linker has not processed the library such that JIT compilation is used as fallback.

Ideally, the library is processed using the Angular Linker to become fully AOT compiled.
Alternatively, the JIT compiler should be loaded by bootstrapping using '@angular/platform-browser-dynamic' or '@angular/platform-server',
or manually provide the compiler with 'import "@angular/compiler";' before bootstrapping.

Please provide the environment you discovered this bug in (run ng version)

Angular CLI: 19.2.13
Node: 22.11.0
Package Manager: yarn 4.9.1
OS: darwin arm64

Angular: 19.2.13
... cli, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, platform-server
... router, ssr

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1902.13 (cli-only)
@angular-devkit/build-angular   19.2.13
@angular-devkit/core            19.2.13 (cli-only)
@angular-devkit/schematics      19.2.13 (cli-only)
@schematics/angular             19.2.13 (cli-only)
rxjs                            7.8.2
typescript                      5.7.3
zone.js                         0.15.1

Anything else?

NodeJS 22.11.0
Yarn 4.9.1

@alan-agius4 alan-agius4 transferred this issue from angular/angular May 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants