Repository navigation
Closed as not planned
Closed as not planned
Copy link
Labels
P4A relatively minor issue that is not relevant to core functionsarea: compilerIssues related to `ngc`, Angular's template compilercompiler: template type-checkinghotlist: error messagesstate: has PR
Milestone
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
No response
Description
Hi there! I hope I am at the right place for this issue; if not please let me know! 😃
When using [ngForTrackBy] together with the *ngFor structural directive (I know (now) that this is wrong 😄), the compilation of an Angular 15 app crashes with an ambiguous error message
$ ng build
✔ Browser application bundle generation complete.
./src/main.ts - Error: Module build failed (from ./node_modules/@ngtools/webpack/src/ivy/index.js):
Error: Could not resolve [object Object] / undefinedAlso, the stack trace given by ng build --verbose does not give any hint on the origin of the issue:
ModuleBuildError: Module build failed (from ./node_modules/@ngtools/webpack/src/ivy/index.js):
Error: Could not resolve [object Object] / undefined
at /Users/user/dev/trackby-repro/node_modules/@ngtools/webpack/src/ivy/loader.js:81:18
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at processResult (/Users/user/dev/trackby-repro/node_modules/webpack/lib/NormalModule.js:760:19)
at /Users/user/dev/trackby-repro/node_modules/webpack/lib/NormalModule.js:862:5
at /Users/user/dev/trackby-repro/node_modules/loader-runner/lib/LoaderRunner.js:400:11
at /Users/user/dev/trackby-repro/node_modules/loader-runner/lib/LoaderRunner.js:252:18
at context.callback (/Users/user/dev/trackby-repro/node_modules/loader-runner/lib/LoaderRunner.js:124:13)
at /Users/user/dev/trackby-repro/node_modules/@ngtools/webpack/src/ivy/loader.js:81:9
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
Minimal Reproduction
import { Component } from '@angular/core';
@Component({
selector: 'app-root',
template: `
<div *ngFor="let c of cs" [ngForTrackBy]="trackByFn(c)">
{{c.id}} - {{c.name}}
</div>`,
styleUrls: ['./app.component.css']
})
export class AppComponent {
cs = [
{id: 123, name: "Test"},
{id: 124, name: "Test"},
]
trackByFn(cs: {id: number, name: string}) {
return cs.id
}
}Exception or Error
./src/main.ts - Error: Module build failed (from ./node_modules/@ngtools/webpack/src/ivy/index.js):
Error: Could not resolve [object Object] / undefined
Your Environment
_ _ ____ _ ___
/ \ _ __ __ _ _ _| | __ _ _ __ / ___| | |_ _|
/ △ \ | '_ \ / _` | | | | |/ _` | '__| | | | | | |
/ ___ \| | | | (_| | |_| | | (_| | | | |___| |___ | |
/_/ \_\_| |_|\__, |\__,_|_|\__,_|_| \____|_____|___|
|___/
Angular CLI: 15.0.5
Node: 18.14.2
Package Manager: npm 9.5.0
OS: darwin arm64
Angular: 15.2.7
... animations, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router
Package Version
---------------------------------------------------------
@angular-devkit/architect 0.1502.6
@angular-devkit/build-angular 15.2.6
@angular-devkit/core 15.2.6
@angular-devkit/schematics 15.0.5
@angular/cli 15.0.5
@schematics/angular 15.0.5
rxjs 7.5.7
typescript 4.8.4
Anything else relevant?
No response
Metadata
Metadata
Assignees
Labels
P4A relatively minor issue that is not relevant to core functionsarea: compilerIssues related to `ngc`, Angular's template compilercompiler: template type-checkinghotlist: error messagesstate: has PR
Activity
[-]Uninformative error message with ngForTrackBy: ./src/main.ts - Error: Module build failed (from ./node_modules/@ngtools/webpack/src/ivy/index.js): Error: Could not resolve [object Object] / undefined[/-][+]Uninformative error message with ngForTrackBy Error: Could not resolve [object Object] / undefined[/+][-]Uninformative error message with ngForTrackBy Error: Could not resolve [object Object] / undefined[/-][+]Uninformative error message with `ngForTrackBy` - `Error: Could not resolve [object Object] / undefined`[/+]fix(compiler-cli): only bind inputs that are part of microsyntax to a…
JeanMeche commentedon Aug 29, 2025
We've deprecated the NgFor structural directive in favor of the
@forblock in v20. We likely won't be addressing this issuefix(compiler-cli): only bind inputs that are part of microsyntax to a…
fix(compiler-cli): only bind inputs that are part of microsyntax to a…
fix(compiler-cli): only bind inputs that are part of microsyntax to a…
fix(compiler-cli): only bind inputs that are part of microsyntax to a…
angular-automatic-lock-bot commentedon Sep 30, 2025
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.