Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

assets entry for the build-angular does not support yarn pnp package paths?

Aperta
#25,263 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
48/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
angular, typescript
Ambito
build-system

Direzione di ricerca

Inizia riproducendo il problema con i passaggi forniti ng new, yarn add, la voce assets in angular.json e yarn build, quindi traccia la gestione degli assets di build-angular e la risoluzione dei relativi percorsi dei pacchetti. Il lavoro è completato quando un percorso di dizionario assets proveniente da un pacchetto Yarn Plug'n'Play viene accettato e copiato nell'output configurato senza l'errore di project source-root.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

area: @angular-devkit/build-angular
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

No response

Description

It does not appear to be possible to include assets and paths from a yarn pnp package.

It seems that build-angular builder supports pnp package resolution for styles, but not assets.

I would expect the assets path (dictionary specification option) to work to copy paths from pacakges in the pnp environment.

Minimal Reproduction

% ng new test-yarn-example --style scss --no-routing
% cd test-yarn-example
% yarn add ng2-pdfjs-viewer

Next, add the path to the angular.json.

Just adding the string will result in the error saying it must be in the project source root.

Adding the dictionary version, yields no error but does not copy the assets either.

     {
                "glob": "**/*",
                "input": "node_modules/ng2-pdfjs-viewer/pdfjs",
                "output": "/assets/pdfjs"
     }

% yarn build

Exception or Error
Unable to copy assets: The ng2-pdfjs-viewer/node_modules/pdfjs asset path must start with the project source root.
Your Environment
Angular CLI: 16.0.2
Node: 18.15.0
Package Manager: yarn 3.5.0
OS: darwin arm64

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

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1600.2 (cli-only)
@angular-devkit/build-angular   16.0.2
@angular-devkit/core            16.0.2 (cli-only)
@angular-devkit/schematics      16.0.2 (cli-only)
@schematics/angular             16.0.2 (cli-only)
rxjs                            7.8.1
typescript                      5.0.4
Anything else relevant?

No response

Lingua principale
TypeScript
Stelle
27k
Fork
11.8k
Merge medio
16h 35m
PR unite (30g)
176

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di angular/angular-cli

Tutte le issue di angular/angular-cli

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.