Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign upBroken routerLink on recompile when used with Ivy #32388
Comments
This comment has been minimized.
This comment has been minimized.
|
Not sure if it matters but I am having the same issue. |
This comment has been minimized.
This comment has been minimized.
|
@alxhub I think this issue is for you. The source code contains: @NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule,
AppRoutingModule
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.scss']
})
export class AppComponent {
title = 'broken-routerLink';
}The key thing to notice is AppComponent.ngComponentDef = _angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵɵdefineComponent"]({
type: AppComponent,
selectors: [["app-root"]],
factory: function AppComponent_Factory(t) {
return new (t || AppComponent)();
},
consts: 2,
vars: 0,
template: function AppComponent_Template(rf, ctx) {
if (rf & 1) {
_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵɵtext"](0, "My App\n");
_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵɵelement"](1, "router-outlet");
}
},
styles: ["\n/*# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IiIsImZpbGUiOiJzcmMvYXBwL2FwcC5jb21wb25lbnQuc2NzcyJ9 */"]
});
/*@__PURE__*/
_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵsetClassMetadata"](AppComponent, [{
type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Component"],
args: [{
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.scss']
}]
}], null, null);The key thing to notice is that When I change So as far as I can tell the issue is that the compiler somehow gets confused with |
This comment has been minimized.
This comment has been minimized.
Previously, the ngtsc compiler attempted to reuse analysis work from the previous program during an incremental build. To do this, it had to prove that the work was safe to reuse - that no changes made to the new program would invalidate the previous analysis. The implementation of this had a significant design flaw: if the previous program had errors, the previous analysis would be missing significant information, and the dependency graph extracted from it would not be sufficient to determine which files should be re-analyzed to fill in the gaps. This often meant that the build output after an error was resolved would be wholly incorrect. This commit switches ngtsc to take a simpler approach to incremental rebuilds. Instead of attempting to reuse prior analysis work, the entire program is re-analyzed with each compilation. This is actually not as expensive as one might imagine - analysis is a fairly small part of overall compilation time. Based on the dependency graph extracted during this analysis, the compiler then can make accurate decisions on whether to emit specific files. A new suite of tests is added to validate behavior in the presence of source code level errors. This new approach is dramatically simpler than the previous algorithm, and should always produce correct results for a semantically correct program.s Fixes angular#32388 Fixes angular#32214
Previously, the ngtsc compiler attempted to reuse analysis work from the previous program during an incremental build. To do this, it had to prove that the work was safe to reuse - that no changes made to the new program would invalidate the previous analysis. The implementation of this had a significant design flaw: if the previous program had errors, the previous analysis would be missing significant information, and the dependency graph extracted from it would not be sufficient to determine which files should be re-analyzed to fill in the gaps. This often meant that the build output after an error was resolved would be wholly incorrect. This commit switches ngtsc to take a simpler approach to incremental rebuilds. Instead of attempting to reuse prior analysis work, the entire program is re-analyzed with each compilation. This is actually not as expensive as one might imagine - analysis is a fairly small part of overall compilation time. Based on the dependency graph extracted during this analysis, the compiler then can make accurate decisions on whether to emit specific files. A new suite of tests is added to validate behavior in the presence of source code level errors. This new approach is dramatically simpler than the previous algorithm, and should always produce correct results for a semantically correct program.s Fixes angular#32388 Fixes angular#32214
Previously, the ngtsc compiler attempted to reuse analysis work from the previous program during an incremental build. To do this, it had to prove that the work was safe to reuse - that no changes made to the new program would invalidate the previous analysis. The implementation of this had a significant design flaw: if the previous program had errors, the previous analysis would be missing significant information, and the dependency graph extracted from it would not be sufficient to determine which files should be re-analyzed to fill in the gaps. This often meant that the build output after an error was resolved would be wholly incorrect. This commit switches ngtsc to take a simpler approach to incremental rebuilds. Instead of attempting to reuse prior analysis work, the entire program is re-analyzed with each compilation. This is actually not as expensive as one might imagine - analysis is a fairly small part of overall compilation time. Based on the dependency graph extracted during this analysis, the compiler then can make accurate decisions on whether to emit specific files. A new suite of tests is added to validate behavior in the presence of source code level errors. This new approach is dramatically simpler than the previous algorithm, and should always produce correct results for a semantically correct program.s Fixes angular#32388 Fixes angular#32214 Fixes angular#32213
Previously, the ngtsc compiler attempted to reuse analysis work from the previous program during an incremental build. To do this, it had to prove that the work was safe to reuse - that no changes made to the new program would invalidate the previous analysis. The implementation of this had a significant design flaw: if the previous program had errors, the previous analysis would be missing significant information, and the dependency graph extracted from it would not be sufficient to determine which files should be re-analyzed to fill in the gaps. This often meant that the build output after an error was resolved would be wholly incorrect. This commit switches ngtsc to take a simpler approach to incremental rebuilds. Instead of attempting to reuse prior analysis work, the entire program is re-analyzed with each compilation. This is actually not as expensive as one might imagine - analysis is a fairly small part of overall compilation time. Based on the dependency graph extracted during this analysis, the compiler then can make accurate decisions on whether to emit specific files. A new suite of tests is added to validate behavior in the presence of source code level errors. This new approach is dramatically simpler than the previous algorithm, and should always produce correct results for a semantically correct program.s Fixes angular#32388 Fixes angular#32214
Previously, the ngtsc compiler attempted to reuse analysis work from the previous program during an incremental build. To do this, it had to prove that the work was safe to reuse - that no changes made to the new program would invalidate the previous analysis. The implementation of this had a significant design flaw: if the previous program had errors, the previous analysis would be missing significant information, and the dependency graph extracted from it would not be sufficient to determine which files should be re-analyzed to fill in the gaps. This often meant that the build output after an error was resolved would be wholly incorrect. This commit switches ngtsc to take a simpler approach to incremental rebuilds. Instead of attempting to reuse prior analysis work, the entire program is re-analyzed with each compilation. This is actually not as expensive as one might imagine - analysis is a fairly small part of overall compilation time. Based on the dependency graph extracted during this analysis, the compiler then can make accurate decisions on whether to emit specific files. A new suite of tests is added to validate behavior in the presence of source code level errors. This new approach is dramatically simpler than the previous algorithm, and should always produce correct results for a semantically correct program.s Fixes angular#32388 Fixes angular#32214
Previously, the ngtsc compiler attempted to reuse analysis work from the previous program during an incremental build. To do this, it had to prove that the work was safe to reuse - that no changes made to the new program would invalidate the previous analysis. The implementation of this had a significant design flaw: if the previous program had errors, the previous analysis would be missing significant information, and the dependency graph extracted from it would not be sufficient to determine which files should be re-analyzed to fill in the gaps. This often meant that the build output after an error was resolved would be wholly incorrect. This commit switches ngtsc to take a simpler approach to incremental rebuilds. Instead of attempting to reuse prior analysis work, the entire program is re-analyzed with each compilation. This is actually not as expensive as one might imagine - analysis is a fairly small part of overall compilation time. Based on the dependency graph extracted during this analysis, the compiler then can make accurate decisions on whether to emit specific files. A new suite of tests is added to validate behavior in the presence of source code level errors. This new approach is dramatically simpler than the previous algorithm, and should always produce correct results for a semantically correct program.s Fixes angular#32388 Fixes angular#32214
…33862) Previously, the ngtsc compiler attempted to reuse analysis work from the previous program during an incremental build. To do this, it had to prove that the work was safe to reuse - that no changes made to the new program would invalidate the previous analysis. The implementation of this had a significant design flaw: if the previous program had errors, the previous analysis would be missing significant information, and the dependency graph extracted from it would not be sufficient to determine which files should be re-analyzed to fill in the gaps. This often meant that the build output after an error was resolved would be wholly incorrect. This commit switches ngtsc to take a simpler approach to incremental rebuilds. Instead of attempting to reuse prior analysis work, the entire program is re-analyzed with each compilation. This is actually not as expensive as one might imagine - analysis is a fairly small part of overall compilation time. Based on the dependency graph extracted during this analysis, the compiler then can make accurate decisions on whether to emit specific files. A new suite of tests is added to validate behavior in the presence of source code level errors. This new approach is dramatically simpler than the previous algorithm, and should always produce correct results for a semantically correct program.s Fixes #32388 Fixes #32214 PR Close #33862
The
routerLinkbreaks when application recompiles. On browser, this is shown as an anchor tag that is not clickable.This works correctly when Ivy is turned off.
Affected Package
I hope the issue may be related to @angular/router or may be Ivy
Description
I put the
<a routerLink=".." ..in a component inside a lazyloaded module. When we stop the server andnpm startagain, this works correctly. But again fails on the next compile-on-save.I turned off the Ivy flag and everything works fine. So this may be related to Ivy.
I was following the lazy-loading-ngmodules guide.
A very minimal zip is attached here (without node_modules).
broken-routerLink.zip
No errors are shown.
Angular Version: