Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

ng serve in Ivy mode is dropping directives list when editing a template #31654

Closed
vikerman opened this issue Jul 18, 2019 · 42 comments

Comments

@vikerman
Copy link
Contributor

commented Jul 18, 2019

馃悶 Bug report

Command (mark with an x)

- [ ] new
- [ ] build
- [x] serve
- [ ] test
- [ ] e2e
- [ ] generate
- [ ] add
- [ ] update
- [ ] lint
- [ ] xi18n
- [ ] run
- [ ] config
- [ ] help
- [ ] version
- [ ] doc

Is this a regression?

Yes, the previous version in which this bug was not present was: ....

Yes. 8.0.0

Description

ng serve(watch mode) seems to be outputting invalid generated code for a simple component when the template is edited.

馃敩 Minimal Reproduction

git clone git@github.com:vikerman/ivy-proj.git
cd ivy-proj

yarn installl

ng serve

<Edit src/app/app.component.html and add more !!! to Hello World>

The browser is refreshed but with the MatButton directive not applied.

馃實 Your Environment


Angular CLI: 8.2.0-next.0
Node: 10.15.3
OS: linux x64
Angular: 8.2.0-next.2
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.802.0-next.0
@angular-devkit/build-angular     0.802.0-next.0
@angular-devkit/build-optimizer   0.802.0-next.0
@angular-devkit/build-webpack     0.802.0-next.0
@angular-devkit/core              8.2.0-next.0
@angular-devkit/schematics        8.2.0-next.0
@angular/cdk                      8.1.1
@angular/cli                      8.2.0-next.0
@angular/material                 8.1.1
@ngtools/webpack                  8.2.0-next.0
@schematics/angular               8.2.0-next.0
@schematics/update                0.802.0-next.0
rxjs                              6.5.2
typescript                        3.4.5
webpack                           4.35.3

@petebacondarwin

This comment has been minimized.

Copy link
Member

commented Jul 19, 2019

After initial compile:

const _c0 = ["mat-raised-button", "", "color", "primary"];
class AppComponent {
    constructor() {
        this.title = 'ivy-proj!!';
    }
}
AppComponent.ngComponentDef = _angular_core__WEBPACK_IMPORTED_MODULE_0__["傻傻defineComponent"]({ type: AppComponent, selectors: [["app-root"]], factory: function AppComponent_Factory(t) { return new (t || AppComponent)(); }, consts: 3, vars: 0, template: function AppComponent_Template(rf, ctx) { if (rf & 1) {
        _angular_core__WEBPACK_IMPORTED_MODULE_0__["傻傻elementStart"](0, "button", _c0);
        _angular_core__WEBPACK_IMPORTED_MODULE_0__["傻傻text"](1, "Hello World");
        _angular_core__WEBPACK_IMPORTED_MODULE_0__["傻傻elementEnd"]();
        _angular_core__WEBPACK_IMPORTED_MODULE_0__["傻傻element"](2, "router-outlet");
    } }, directives: [_angular_material__WEBPACK_IMPORTED_MODULE_1__["MatButton"], _angular_router__WEBPACK_IMPORTED_MODULE_2__["RouterOutlet"]], 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);

After incremental compile:

const _c0 = ["mat-raised-button", "", "color", "primary"];
class AppComponent {
    constructor() {
        this.title = 'ivy-proj!!';
    }
}
AppComponent.ngComponentDef = _angular_core__WEBPACK_IMPORTED_MODULE_0__["傻傻defineComponent"]({ type: AppComponent, selectors: [["app-root"]], factory: function AppComponent_Factory(t) { return new (t || AppComponent)(); }, consts: 3, vars: 0, template: function AppComponent_Template(rf, ctx) { if (rf & 1) {
        _angular_core__WEBPACK_IMPORTED_MODULE_0__["傻傻elementStart"](0, "button", _c0);
        _angular_core__WEBPACK_IMPORTED_MODULE_0__["傻傻text"](1, "Hello World");
        _angular_core__WEBPACK_IMPORTED_MODULE_0__["傻傻elementEnd"]();
        _angular_core__WEBPACK_IMPORTED_MODULE_0__["傻傻element"](2, "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);

You can see that directives: [_angular_material__WEBPACK_IMPORTED_MODULE_1__["MatButton"], _angular_router__WEBPACK_IMPORTED_MODULE_2__["RouterOutlet"]] is missing from the incremental compile output.

@petebacondarwin

This comment has been minimized.

Copy link
Member

commented Jul 19, 2019

OK, so I think I know what is going on...

In the incremental compilation case we are not re-compiling the app.module.ts, which has the NgModule that owns the AppComponent. This leads to missing metadata in the compilation scope of the component and so the missing directives.

We need to tweak the dependency analysis in ngtsc to ensure that app.module.ts is marked as changed if a resource of one of its source dependencies changes.

@alan-agius4 alan-agius4 transferred this issue from angular/angular-cli Jul 19, 2019

@ngbot ngbot bot added this to the needsTriage milestone Jul 19, 2019

petebacondarwin added a commit to petebacondarwin/angular that referenced this issue Jul 19, 2019

fix(ivy): include NgModule in incremental compilation if template cha鈥
鈥ges

Previously if a template changed then we would know to rebuild its component
source file, but we were not noticing that its NgModule needed rebuilding too.

Now we include resource changes as dependencies when computing which
files are unchanged.

Fixes angular#31654

petebacondarwin added a commit to petebacondarwin/angular that referenced this issue Jul 19, 2019

fix(ivy): include NgModule in incremental compilation if template cha鈥
鈥ges

Previously if a template changed then we would know to rebuild its component
source file, but we were not noticing that its NgModule needed rebuilding too.

Now we include resource changes as dependencies when computing which
files are unchanged.

Fixes angular#31654

@ngbot ngbot bot modified the milestones: needsTriage, Backlog Jul 23, 2019

@alxhub alxhub added this to Backlog in ngtsc quality Jul 23, 2019

@kolkov

This comment has been minimized.

Copy link

commented Jul 24, 2019

  • loses code changes on reload (not only in templates)
@petebacondarwin

This comment has been minimized.

Copy link
Member

commented Jul 24, 2019

@kolkov - can you be more specific?

@kolkov

This comment has been minimized.

Copy link

commented Jul 25, 2019

I wanted to say that not only the directives do not fall, but the other code changed in the IDE is also not updated in the browser sometimes.

@petebacondarwin

This comment has been minimized.

Copy link
Member

commented Jul 25, 2019

@kolkov - can you provide a reproduction? Specifically what changes do you make? What is the setup of the project you are testing it on?

@kolkov

This comment has been minimized.

Copy link

commented Jul 27, 2019

@petebacondarwin If I changes scss, browser is reloading, but page not changed. I try to create reproduction exapmle and create new issue for it. I tryed to serve this without Ivy enabled and this bug was present too.

@petebacondarwin

This comment has been minimized.

Copy link
Member

commented Jul 27, 2019

Great. Thanks @kolkov. The bug is that the recompilation doesn't happen properly for a change to any "resource", i.e template or styles.

@Ploppy3

This comment has been minimized.

Copy link

commented Jul 30, 2019

@petebacondarwin This is so far the worst issue I got with Angular, the need to recompile twice on big projects to see the CSS changes is real pain.

When can we expect a fix for this?

There was an issue opened a week or so ago specifically related to the CSS needing 2 recompilation, I can't find it anymore, can someone share the link?

@kolkov

This comment has been minimized.

Copy link

commented Jul 30, 2019

@Ploppy3 I do not understand how they want to release version 8.2.0 without first closing this major problem ...?

@petebacondarwin

This comment has been minimized.

Copy link
Member

commented Jul 30, 2019

Does this affect all projects or only those with ivy enabled? I thought the latter - in which case this bug should only affect people trying out ivy.

@kolkov

This comment has been minimized.

Copy link

commented Jul 30, 2019

@petebacondarwin I have this issue with disabled Ivy on last RC.0. :((((

@petebacondarwin

This comment has been minimized.

Copy link
Member

commented Jul 30, 2019

That's strange because incremental compilation is only available for ivy builds. Let me see if I can reproduce it for a ViewEngine project...

@kolkov

This comment has been minimized.

Copy link

commented Jul 30, 2019

@petebacondarwinI sent you an invitation to my private repo. Thanks!

@kolkov

This comment has been minimized.

Copy link

commented Jul 30, 2019

@petebacondarwin

Angular CLI: 8.2.0-next.1
Node: 12.6.0
OS: win32 x64
Angular: 8.2.0-rc.0
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router, service-worker

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.802.0-next.1
@angular-devkit/build-angular     0.802.0-next.1
@angular-devkit/build-optimizer   0.802.0-next.1
@angular-devkit/build-webpack     0.802.0-next.1
@angular-devkit/core              8.1.1
@angular-devkit/schematics        8.1.1
@angular/cli                      8.2.0-next.1
@angular/pwa                      0.801.1
@ngtools/webpack                  8.2.0-next.1
@schematics/angular               8.1.1
@schematics/update                0.802.0-next.1
rxjs                              6.5.2
typescript                        3.5.3
webpack                           4.35.3
@kolkov

This comment has been minimized.

Copy link

commented Jul 30, 2019

@petebacondarwin Did you use AOT at ng serve?

@petebacondarwin

This comment has been minimized.

Copy link
Member

commented Jul 30, 2019

In your app the ng start triggers AOT. But I tried it with and without :-/

@kolkov

This comment has been minimized.

Copy link

commented Jul 30, 2019

@petebacondarwin How can I debug this?

@kolkov

This comment has been minimized.

Copy link

commented Jul 30, 2019

@petebacondarwin This is somehow related to AOT, as soon as I turned off the AOT flag, everything began to work fine.

@petebacondarwin

This comment has been minimized.

Copy link
Member

commented Jul 30, 2019

@kolkov are you 100% sure you are not running with ivy enabled? With AOT turned off we don't go through the ngtsc compiler so it would indeed not show these problems. With AOT turned on (and ivy enabled) then I would expect to hit this problem. Perhaps there is another tsconfig.json somewhere that is enabling ivy?

@kolkov

This comment has been minimized.

Copy link

commented Jul 30, 2019

@petebacondarwin that private project in actual state...

@kolkov

This comment has been minimized.

Copy link

commented Jul 30, 2019

image

@kolkov

This comment has been minimized.

Copy link

commented Jul 30, 2019

image

@kolkov

This comment has been minimized.

Copy link

commented Jul 30, 2019

@petebacondarwin try to enable Ivy, serve project with Ivy, and then disable Ivy in ui/projects/inframe-office/tsconfig.app.json, and re serve again.

@petebacondarwin

This comment has been minimized.

Copy link
Member

commented Jul 30, 2019

@kolkov sent you a message to your Gmail address.

@kolkov

This comment has been minimized.

Copy link

commented Jul 30, 2019

image

@kolkov

This comment has been minimized.

Copy link

commented Jul 30, 2019

@petebacondarwin it's not a permanent problem, it's time to time...
image

@kolkov

This comment has been minimized.

Copy link

commented Jul 30, 2019

@petebacondarwin building log from IDE

> ui@0.1.0 start D:\Go\inframe\ui
> ng serve --proxy-config proxy.conf.json --aot

 10% building 3/3 modules 0 activei 锝ds锝: Project is running at http://localhost:4200/webpack-dev-server/
i 锝ds锝: webpack output is served from /
i 锝ds锝: 404s will fallback to //index.html
chunk {base-base-module-ngfactory} base-base-module-ngfactory.js, base-base-module-ngfactory.js.map (base-base-module-ngfactory) 12.6 kB  [rendered]
chunk {casting-casting-module-ngfactory} casting-casting-module-ngfactory.js, casting-casting-module-ngfactory.js.map (casting-casting-module-ngfactory) 61.7 kB  [rendered]
chunk {default~base-base-module-ngfactory~production-production-module-ngfactory~settings-settings-module-ngfactory} default~base-base-module-ngfactory~production-production-module-ngfactory~settings-settings-module-ngfactory.js, default~base-base-module-ngfact
ory~production-production-module-ngfactory~settings-settings-module-ngfactory.js.map (default~base-base-module-ngfactory~production-production-module-ngfactory~settings-settings-module-ngfactory) 30.1 kB  [rendered]
chunk {main} main.js, main.js.map (main) 512 kB [initial] [rendered]
chunk {polyfills} polyfills.js, polyfills.js.map (polyfills) 130 kB [initial] [rendered]
chunk {production-production-module-ngfactory} production-production-module-ngfactory.js, production-production-module-ngfactory.js.map (production-production-module-ngfactory) 13.5 kB  [rendered]
chunk {runtime} runtime.js, runtime.js.map (runtime) 9.4 kB [entry] [rendered]
chunk {settings-settings-module-ngfactory} settings-settings-module-ngfactory.js, settings-settings-module-ngfactory.js.map (settings-settings-module-ngfactory) 15.6 kB  [rendered]
chunk {styles} styles.js, styles.js.map (styles) 318 kB [initial] [rendered]
chunk {vendor} vendor.js, vendor.js.map (vendor) 3.53 MB [initial] [rendered]
Date: 2019-07-30T14:26:15.418Z - Hash: 0db388005755977ff9d0 - Time: 21244ms
** Angular Live Development Server is listening on localhost:4200, open your browser on http://localhost:4200/ **
i 锝dm锝: Compiled successfully.
i 锝dm锝: Compiling...

Date: 2019-07-30T14:27:45.149Z - Hash: 0db388005755977ff9d0
10 unchanged chunks

Time: 3914ms
i 锝dm锝: Compiled successfully.
i 锝dm锝: Compiling...

Date: 2019-07-30T14:34:32.087Z - Hash: d6f2e6f598764a310756
9 unchanged chunks
chunk {casting-casting-module-ngfactory} casting-casting-module-ngfactory.js, casting-casting-module-ngfactory.js.map (casting-casting-module-ngfactory) 61.7 kB  [rendered]
Time: 3029ms
i 锝dm锝: Compiled successfully.
i 锝dm锝: Compiling...

Date: 2019-07-30T14:34:50.297Z - Hash: d6f2e6f598764a310756
10 unchanged chunks

Time: 1883ms
i 锝dm锝: Compiled successfully.
i 锝dm锝: Compiling...

Date: 2019-07-30T14:35:34.357Z - Hash: 0db388005755977ff9d0
9 unchanged chunks
chunk {casting-casting-module-ngfactory} casting-casting-module-ngfactory.js, casting-casting-module-ngfactory.js.map (casting-casting-module-ngfactory) 61.7 kB  [rendered]
Time: 2370ms
i 锝dm锝: Compiled successfully.
i 锝dm锝: Compiling...

Date: 2019-07-30T14:35:43.567Z - Hash: 0db388005755977ff9d0
10 unchanged chunks

Time: 2135ms
i 锝dm锝: Compiled successfully.
i 锝dm锝: Compiling...

Date: 2019-07-30T14:38:12.042Z - Hash: 0db388005755977ff9d0
10 unchanged chunks

Time: 2985ms
i 锝dm锝: Compiled successfully.
i 锝dm锝: Compiling...
 50% building 0/5 modules 5 active D:\Go\inframe\ui\node_mo
Date: 2019-07-30T14:38:14.245Z - Hash: 0db388005755977ff9d0
10 unchanged chunks

Time: 1900ms
i 锝dm锝: Compiled successfully.
i 锝dm锝: Compiling...

Date: 2019-07-30T14:38:31.074Z - Hash: 0db388005755977ff9d0
10 unchanged chunks

Time: 2053ms
i 锝dm锝: Compiled successfully.
i 锝dm锝: Compiling...

Date: 2019-07-30T14:38:36.714Z - Hash: 0db388005755977ff9d0
10 unchanged chunks

Time: 1859ms
i 锝dm锝: Compiled successfully.
i 锝dm锝: Compiling...

Date: 2019-07-30T14:38:55.138Z - Hash: 0db388005755977ff9d0
10 unchanged chunks

Time: 1954ms
i 锝dm锝: Compiled successfully.
i 锝dm锝: Compiling...
i 锝dm锝: wait until bundle finished: /casting

Date: 2019-07-30T14:38:57.411Z - Hash: 0db388005755977ff9d0
10 unchanged chunks

Time: 1704ms
i 锝dm锝: Compiled successfully.
i 锝dm锝: Compiling...

Date: 2019-07-30T14:39:17.639Z - Hash: 0db388005755977ff9d0
10 unchanged chunks

Time: 1698ms
i 锝dm锝: Compiled successfully.
i 锝dm锝: Compiling...

Date: 2019-07-30T14:39:41.527Z - Hash: 0db388005755977ff9d0
10 unchanged chunks

Time: 1441ms
i 锝dm锝: Compiled successfully.
i 锝dm锝: Compiling...

Date: 2019-07-30T14:39:55.912Z - Hash: 0db388005755977ff9d0
10 unchanged chunks

Time: 1424ms
i 锝dm锝: Compiled successfully.
i 锝dm锝: Compiling...

Date: 2019-07-30T14:40:03.736Z - Hash: 0db388005755977ff9d0
10 unchanged chunks

Time: 1404ms
i 锝dm锝: Compiled successfully.
i 锝dm锝: Compiling...

Date: 2019-07-30T14:40:40.938Z - Hash: 55280d8bde3e883ec8f2
9 unchanged chunks
chunk {casting-casting-module-ngfactory} casting-casting-module-ngfactory.js, casting-casting-module-ngfactory.js.map (casting-casting-module-ngfactory) 61.7 kB  [rendered]
Time: 2324ms
i 锝dm锝: Compiled successfully.
i 锝dm锝: Compiling...

Date: 2019-07-30T14:40:53.751Z - Hash: 55280d8bde3e883ec8f2
10 unchanged chunks

Time: 1773ms
i 锝dm锝: Compiled successfully.
i 锝dm锝: Compiling...

Date: 2019-07-30T14:41:06.573Z - Hash: 0db388005755977ff9d0
9 unchanged chunks
chunk {casting-casting-module-ngfactory} casting-casting-module-ngfactory.js, casting-casting-module-ngfactory.js.map (casting-casting-module-ngfactory) 61.7 kB  [rendered]
Time: 1616ms
i 锝dm锝: Compiled successfully.
i 锝dm锝: Compiling...

Date: 2019-07-30T14:41:16.597Z - Hash: 0db388005755977ff9d0
10 unchanged chunks

Time: 1666ms
i 锝dm锝: Compiled successfully.
i 锝dm锝: Compiling...

Date: 2019-07-30T14:41:22.638Z - Hash: 0db388005755977ff9d0
10 unchanged chunks

Time: 1651ms
i 锝dm锝: Compiled successfully.
i 锝dm锝: Compiling...

Date: 2019-07-30T14:41:28.591Z - Hash: 0db388005755977ff9d0
10 unchanged chunks

Time: 1493ms
i 锝dm锝: Compiled successfully.
i 锝dm锝: Compiling...

Date: 2019-07-30T14:41:46.626Z - Hash: 254a057a65cea74ec920
9 unchanged chunks
chunk {casting-casting-module-ngfactory} casting-casting-module-ngfactory.js, casting-casting-module-ngfactory.js.map (casting-casting-module-ngfactory) 61.7 kB  [rendered]
Time: 1781ms
i 锝dm锝: Compiled successfully.
i 锝dm锝: Compiling...

Date: 2019-07-30T14:42:00.181Z - Hash: 254a057a65cea74ec920
10 unchanged chunks

Time: 1642ms
i 锝dm锝: Compiled successfully.


@kolkov

This comment has been minimized.

Copy link

commented Jul 30, 2019

@petebacondarwin I change styles at lazy module... maybe this can help.
image

@Ploppy3

This comment has been minimized.

Copy link

commented Jul 31, 2019

@petebacondarwin I noticed that my versions weren't in sync, which seems to be the case for @kolkov too, I updated my dependencies and now the CSS part of the problem seems to be gone. Though, Ivy recompilation is still broken when I update the template.

NB: On a project running the --next branch, updating with ng update will not update all packages to the newest beta, you have to always update with ng update --next, note that, on the ng version report above, all the packages @angular-devkit/... are running the 0.802.0-next.1 version when it should be 0.802.0-rc.0, hope it helps.

@Ploppy3

This comment has been minimized.

Copy link

commented Jul 31, 2019

Also the ng version report by the OP @vikerman had the same problem, mismatched versions.

@kolkov

This comment has been minimized.

Copy link

commented Jul 31, 2019

@Ploppy3 yes caused by "@angular-devkit/build-angular": "0.802.0-next.1", this fixed in latest "@angular-devkit/build-angular": "0.802.0-rc.0",

@petebacondarwin

This comment has been minimized.

Copy link
Member

commented Jul 31, 2019

The problem with the IVY incremental builds is still broken... we are working on a fix - see #31655, which fixes it but not the correct way.

@kolkov's problem was not IVY related and was fixed in @angular-devkit/build-angular@0.802.0-rc.0 as he reports by this commit: angular/angular-cli@6649483

@Ploppy3

This comment has been minimized.

Copy link

commented Jul 31, 2019

@petebacondarwin Ok thanks for the explanation. Please keep in mind that the 3 of us got mismatched versions as there is no warning whatsoever when you use ng update on the beta branch. Do you feel like I should open an issue or is it OK since it is only related to the beta?

@kolkov

This comment has been minimized.

Copy link

commented Jul 31, 2019

Thanks!

@petebacondarwin

This comment has been minimized.

Copy link
Member

commented Jul 31, 2019

@Ploppy3 - yes please open an issue on the CLI repo. I think there should at least be peerDependency warnings...

petebacondarwin added a commit to petebacondarwin/angular that referenced this issue Jul 31, 2019

fix(ivy): reuse compilation scope for incremental template changes.
Previously if only a component template changed then we would know to
rebuild its component source file. But the compilation was incorrect if the
component was part of an NgModule, since we were not capturing the
compilation scope information that had a been acquired from the NgModule
and was not being regenerated since we were not needing to recompile
the NgModule.

Now we register compilation scope information for each component, via the
`ComponentScopeRegistry` interface, so that it is available for incremental
compilation.

The `ComponentDecoratorHandler` now reads the compilation scope from a
`ComponentScopeReader` interface which is implemented as a compound
reader composed of the original `LocalModuleScopeRegistry` and the
`IncrementalState`.

Fixes angular#31654

petebacondarwin added a commit to petebacondarwin/angular that referenced this issue Jul 31, 2019

fix(ivy): reuse compilation scope for incremental template changes.
Previously if only a component template changed then we would know to
rebuild its component source file. But the compilation was incorrect if the
component was part of an NgModule, since we were not capturing the
compilation scope information that had a been acquired from the NgModule
and was not being regenerated since we were not needing to recompile
the NgModule.

Now we register compilation scope information for each component, via the
`ComponentScopeRegistry` interface, so that it is available for incremental
compilation.

The `ComponentDecoratorHandler` now reads the compilation scope from a
`ComponentScopeReader` interface which is implemented as a compound
reader composed of the original `LocalModuleScopeRegistry` and the
`IncrementalState`.

Fixes angular#31654

petebacondarwin added a commit to petebacondarwin/angular that referenced this issue Jul 31, 2019

fix(ivy): reuse compilation scope for incremental template changes.
Previously if only a component template changed then we would know to
rebuild its component source file. But the compilation was incorrect if the
component was part of an NgModule, since we were not capturing the
compilation scope information that had a been acquired from the NgModule
and was not being regenerated since we were not needing to recompile
the NgModule.

Now we register compilation scope information for each component, via the
`ComponentScopeRegistry` interface, so that it is available for incremental
compilation.

The `ComponentDecoratorHandler` now reads the compilation scope from a
`ComponentScopeReader` interface which is implemented as a compound
reader composed of the original `LocalModuleScopeRegistry` and the
`IncrementalState`.

Fixes angular#31654

petebacondarwin added a commit to petebacondarwin/angular that referenced this issue Aug 6, 2019

fix(ivy): reuse compilation scope for incremental template changes.
Previously if only a component template changed then we would know to
rebuild its component source file. But the compilation was incorrect if the
component was part of an NgModule, since we were not capturing the
compilation scope information that had a been acquired from the NgModule
and was not being regenerated since we were not needing to recompile
the NgModule.

Now we register compilation scope information for each component, via the
`ComponentScopeRegistry` interface, so that it is available for incremental
compilation.

The `ComponentDecoratorHandler` now reads the compilation scope from a
`ComponentScopeReader` interface which is implemented as a compound
reader composed of the original `LocalModuleScopeRegistry` and the
`IncrementalState`.

Fixes angular#31654

@kara kara closed this in eb5412d Aug 9, 2019

pkozlowski-opensource added a commit to pkozlowski-opensource/angular that referenced this issue Aug 12, 2019

fix(ivy): reuse compilation scope for incremental template changes. (a鈥
鈥gular#31932)

Previously if only a component template changed then we would know to
rebuild its component source file. But the compilation was incorrect if the
component was part of an NgModule, since we were not capturing the
compilation scope information that had a been acquired from the NgModule
and was not being regenerated since we were not needing to recompile
the NgModule.

Now we register compilation scope information for each component, via the
`ComponentScopeRegistry` interface, so that it is available for incremental
compilation.

The `ComponentDecoratorHandler` now reads the compilation scope from a
`ComponentScopeReader` interface which is implemented as a compound
reader composed of the original `LocalModuleScopeRegistry` and the
`IncrementalState`.

Fixes angular#31654

PR Close angular#31932
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can鈥檛 perform that action at this time.