Skip to content

Angular compiler generates factories for components not found in a template or entry components #16984

Closed

Description

@maxkoretskyi

I'm submitting a ... (check one with "x")

[ x] bug report => search github for a similar issue or PR before submitting
[ ] feature request
[ ] support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question

Current behavior

The component factory is generated for the component not used in a template and not added to the entry components list. See this screenshot

Expected behavior
The docs say in Why do we need entry components:

If a component isn't an entry component or wasn't found in a template, the compiler omits it.

Minimal reproduction of the problem with instructions
Go to the plunker and open Dev tools->Source tab->plunkerPreviewTarget->ng://->AppModule->AComp.ngfactory.js

  • Angular version: 4.1.3

Activity

  1. Toxicable commented on May 27, 2017

    @Toxicable

    I believe this is mainly focused at AOT since if you ran the same code in AOT you would get an error similar to Cannot determine the module for class AComp

  2. maxkoretskyi commented on May 27, 2017

    @maxkoretskyi
    Author

    @chuckjaz, if it's identified as a bug by a core team I'm willing to prepare a fix, but I'd need some guidance

  3. tbosch commented on May 30, 2017

    @tbosch
    Contributor

    Angular's jit compiler compiles all components that are mentioned in an NgModule, no matter if it is used or not. In that, it is similar to the AOT compiler.

    This makes JIT compilation slower, but JIT is not intended for production use anyways, and doing it this way simplifies our internal code a lot.

  4. tbosch commented on May 30, 2017

    @tbosch
    Contributor

    so this works as expected.

  5. maxkoretskyi commented on May 31, 2017

    @maxkoretskyi
    Author

    @tbosch , so what's the use for entryComponents then?

    And does it also mean that this phrase in the docs

    If a component isn't an entry component or wasn't found in a template, the compiler omits it.

    is not correct?

  6. angular-automatic-lock-bot commented on Sep 11, 2019

    @angular-automatic-lock-bot

    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.

  7. locked and limited conversation to collaborators on Sep 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions