Closed
Description
Command
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
16, might've worked in an earlier 17.0.x version
Description
When using "aot": false
, there are two critical issues with ng serve
.
.html
files do not seem to be watched, so changes do not trigger a rebuild/refresh.- Saving
.ts
files trigger a rebuild, but the build always fail (see error below). NOTE: Does not happen on every save, but can be reproduced consistently.
The above means that ng serve
has to be exited and re-run on every change, which makes it pretty much unusable.
Minimal Reproduction
ng new myproject
cd myproject
- Add
"aot": false
to the angular.json builder options (projects.myproject.architect.build.options.aot
) ng serve
- Make changes to and save
app.component.html
andapp.component.ts
Exception or Error
Two issues:
1. Changes to `app.component.html` does not trigger rebuild. The only way for the changes to take effect is to quit and run `ng serve` again.
2. When saving `app.component.ts`, an error is shown:
⠋ Changes detected. Rebuilding...
✘ [ERROR] File 'src/app/app.component.ts' is missing from the TypeScript compilation. [plugin angular-compiler]
src/main.ts:3:29:
3 │ import { AppComponent } from './app/app.component';
╵ ~~~~~~~~~~~~~~~~~~~~~
Ensure the file is part of the TypeScript program via the 'files' or 'include' property.
Your Environment
_ _ ____ _ ___
/ \ _ __ __ _ _ _| | __ _ _ __ / ___| | |_ _|
/ △ \ | '_ \ / _` | | | | |/ _` | '__| | | | | | |
/ ___ \| | | | (_| | |_| | | (_| | | | |___| |___ | |
/_/ \_\_| |_|\__, |\__,_|_|\__,_|_| \____|_____|___|
|___/
Angular CLI: 17.0.6
Node: 20.9.0
Package Manager: npm 10.2.3
OS: darwin arm64
Angular: 17.0.6
... animations, cli, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router
Package Version
---------------------------------------------------------
@angular-devkit/architect 0.1700.6
@angular-devkit/build-angular 17.0.6
@angular-devkit/core 17.0.6
@angular-devkit/schematics 17.0.6
@schematics/angular 17.0.6
rxjs 7.8.1
typescript 5.2.2
zone.js 0.14.2
Anything else relevant?
This happens both with the browser-eslint
and the application
builder.
Related: #26379