Skip to content

size regression due to host view factories generated for non-entryComponents #19857

@IgorMinar

Description

@IgorMinar

I'm submitting a...


[ ] Regression (a behavior that used to work and stopped working in a new release)
[x] Bug report  
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question

Current behavior

in v4 the AOT compiler generated host view factories only for entryComponents in v5.0.0.rc2 we generate them even for components that are not marked as entryComponents.

Example in aio is SearchResultsComponent, which is not marked as entryComponent. When upgrading from 5.0.0-beta.3, I noticed that we now started generating View_SearchResultsComponent_Host_0 for this component. And we do it in a way that tightly couples it with the rest of the component factories, so it can't be eliminated.

Relevant snippets of the generated code:

function View_SearchResultsComponent_Host_0(_l) {
  return viewDef(0, [ (_l()(), elementDef(0, 0, null, null, 1, "aio-search-results", [], null, null, null, View_SearchResultsComponent_0, RenderType_SearchResultsComponent)), directiveDef(1, 573440, null, 0, search_results_component_SearchResultsComponent, [], null, null) ], null, null);
}

styles_FileNotFoundSearchComponent = (createComponentFactory("aio-search-results", search_results_component_SearchResultsComponent, View_SearchResultsComponent_Host_0, {
  searchResults: "searchResults"
}

RenderType_FileNotFoundSearchComponent = createRendererType2({
  encapsulation: 2,
  styles: styles_FileNotFoundSearchComponent,
  data: {}
})

Is this expected? My understanding is that the host factories are only needed for entryComponents.

I can't estimate how significant this size regression is for aio because I'm unfortunately updating various dependencies. Due to bugs and api incompatibilities can't isolate the change just to the change of the compiler. Overall I'm looking for about 30kb size increase which might or might not contain other size regressions.

Metadata

Metadata

Assignees

Labels

regressionIndicates than the issue relates to something that worked in a previous version

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions