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

Project-wide preserveWhitespaces option is ignored

Chiusa
#631 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@edbzn ci sta già lavorando.

Dal 25/10/2026.

  • #637 di @edbzn — aperta

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
35/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
angular, rust
Ambito
backend

Direzione di ricerca

Start with compile_component_full and trace how it builds template parse options from metadata.preserve_whitespaces; compare that with the project default described in the issue. Check transformAngularFile and compileComponentHmrUpdate for the same option handling, then run the mentioned ngtsc spec, "should take preserveWhitespaces config option into account." Done means the project-wide setting is honored while a component decorator can override it; pull request #637 is already open.

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

Descrizione

Summary

The project-wide preserveWhitespaces option (ngc's angularCompilerOptions.preserveWhitespaces) is ignored. TransformOptions.preserveWhitespaces exists, but transformAngularFile and compileComponentHmrUpdate only read the decorator's own preserveWhitespaces. A project that sets true globally therefore renders with collapsed whitespace, which can change the gaps between inline elements. The Vite plugin also has no way to set it.

Found by running Angular's ngtsc spec ngtsc_spec.ts: "should take preserveWhitespaces config option into account" against oxc.

Reproduction

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

@Component({selector: 'test', template: `<div>
    Template with whitespaces
  </div>`})
export class TestCmp {}

compiled with transformAngularFileSync(src, file, { preserveWhitespaces: true }).

Actual
i0.ɵɵtext(1, " Template with whitespaces ");
Expected (ngc, preserveWhitespaces: true)
i0.ɵɵtext(1, "\n    Template with whitespaces\n  ");

Cause

compile_component_full builds the template parse options from metadata.preserve_whitespaces only. ngtsc's parseTemplateDeclaration (annotations/component/src/resources.ts) starts from the project default and lets the decorator override it.

Lingua principale
Rust
Stelle
244
Fork
26
Merge medio
23h 41m
PR unite (30g)
106

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

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 voidzero-dev/oxc-angular-compiler

Tutte le issue di voidzero-dev/oxc-angular-compiler

Issue simili

Altre issue su Rust

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.