Repository navigation
Closed
Description
Command
build, 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
17.1
Description
The CLI throws the following error when running the provided repro.
[✘ [ERROR] Cannot read properties of null (reading 'errors') [plugin angular-compiler]
node_modules/@angular-devkit/build-angular/src/tools/esbuild/angular/compiler-plugin.js:199:32:
199 │ if (diagnostics.errors?.length) {
╵ ^
at /Users/kyro/Developer/web/angular-projects/next/node_modules/@angular-devkit/build-angular/src/tools/esbuild/angular/compiler-plugin.js:199:33
at async /Users/kyro/Developer/web/angular-projects/next/node_modules/esbuild/lib/main.js:1350:22
at async Promise.all (index 0)
at async requestCallbacks.on-start (/Users/kyro/Developer/web/angular-projects/next/node_modules/esbuild/lib/main.js:1348:5)
at async handleRequest (/Users/kyro/Developer/web/angular-projects/next/node_modules/esbuild/lib/main.js:732:11)
This error came from the "onStart" callback registered here:
node_modules/@angular-devkit/build-angular/src/tools/esbuild/angular/compiler-plugin.js:81:18:
81 │ build.onStart(async () => {
╵ ~~~~~~~
at setup (/Users/kyro/Developer/web/angular-projects/next/node_modules/@angular-devkit/build-angular/src/tools/esbuild/angular/compiler-plugin.js:81:19)
at async handlePlugins
Minimal Reproduction
Repro : https://github.com/jeanmeche/next
The issue doesn't not happen when either
- The
Childcomponent is exported - Signal input is removed.
While there is maybe an issue on the signal implementation part, the CLI probably shouldn't throw the way it does.
Your Environment
_ _ ____ _ ___
/ \ _ __ __ _ _ _| | __ _ _ __ / ___| | |_ _|
/ △ \ | '_ \ / _` | | | | |/ _` | '__| | | | | | |
/ ___ \| | | | (_| | |_| | | (_| | | | |___| |___ | |
/_/ \_\_| |_|\__, |\__,_|_|\__,_|_| \____|_____|___|
|___/
Angular CLI: 17.1.2
Node: 18.17.0
Package Manager: npm 9.6.7
OS: darwin x64
Angular: 17.1.2
... animations, cli, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, platform-server
... router, ssr
Package Version
---------------------------------------------------------
@angular-devkit/architect 0.1701.2
@angular-devkit/build-angular 17.1.2
@angular-devkit/core 17.1.2
@angular-devkit/schematics 17.1.2
@schematics/angular 17.1.2
rxjs 7.8.1
typescript 5.3.3
zone.js 0.14.3
Metadata
Metadata
Assignees
Labels
No labels
Activity
ducin commentedon Feb 5, 2024
hey I did the repo first https://github.com/ducin/angular-issue-not-exported-class 😅
JeanMeche commentedon Feb 6, 2024
Seems like there was a related issue on the FW repo : angular/angular#53678
There framework throwing an error is one thing, but it should thrown correctly by the application builder.
alan-agius4 commentedon Feb 6, 2024
This is a bug in the compiler as calling
compilation.diagnoseFiles()is retuningundefinedwhich should never happen.[-]CLI throws unexpectedly[/-][+]`compilation.diagnoseFiles()` is retuning `undefined`[/+]alxhub commentedon Feb 6, 2024
@alan-agius4 which
compilationis that? I don't think we have adiagnoseFilesfunction anywhere inngc.alan-agius4 commentedon Feb 6, 2024
@alxhub, apologies, I did not initial realize that it's an Angular CLI implementation.
alan-agius4 commentedon Feb 7, 2024
This is similar to : angular/angular#53678 where the compiler is throwing a
FatalDiagnosticErroron the typecheck file. Now since this is not an instance ofErrorthe Piscina will assume that an error did not occur and will not exit successfully and not with an error.From my understanding the Angular compiler should never surface a
FatalDiagnosticError, and it should be transformed to adiagnosticsinternally. Is this correct @alxhub / @JoostK? As otherwise, we'd need to exposeFatalDiagnosticErrorandisFatalDiagnosticErrorAPIs from the Compiler and make them accessable to the Angular CLI.So in my eyes there are 2 problems here:
FatalDiagnosticErrorit is not thrown.//cc @devversion, who modified the above code recently in angular/angular@760b1f3
[-]`compilation.diagnoseFiles()` is retuning `undefined`[/-][+]`FatalDiagnosticError` is being thrown by the compiler when using signal input or `Child` component is not exported[/+][-]`FatalDiagnosticError` is being thrown by the compiler when using signal input or `Child` component is not exported[/-][+]`FatalDiagnosticError` is being thrown by the compiler when removing signal input or `Child` component is not exported[/+]devversion commentedon Feb 7, 2024
Yeah, so to clarify: Before my "fix", we did not catch fatal diagnostics at all when collecting extended diagnostics. This surfaced these super hard to debug errors when e.g. a class was not exported and the TCB code couldn't be generated at all- the same is used for extended diagnostics.
It looks like as part of my fix, I did forget returning early and therefore diagnostics are converted properly now (before they weren't)- but we are still throwing. So my fix was a noop. I'm sending a fix- but the root causes are still:
alan-agius4 commentedon Feb 7, 2024
The error is being swallowed as
FatalDiagnosticErroris notErrorwhich causes the worker to exit without an error. See check in piscinajs. As per convo with @devversion, he will try to make these as errors.alan-agius4 commentedon Feb 7, 2024
Closed via angular/angular#54309
angular-automatic-lock-bot commentedon Mar 9, 2024
This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.