Skip to content

how to lazy load a module from a package ?  #2601

Closed

Description

@jjlgjkkl

we have some modules published as package, and in this project we need to lazy load the module

if the module in the target project, it's ok , like :

export const routes: Routes = [
{ path: '', redirectTo: 'test01', pathMatch: 'full'},
{ path: 'test01', loadChildren: 'app/testing01/test01.module' },
]

but, how can i load modules from package , like this:
{ path: 'test01', loadChildren: '@xxx/testing01/test01.module' },

i am using

"angular-cli": "1.0.0-beta.15",
@angular 2.0.0

thank you and being in touch

Activity

  1. filipesilva commented on Oct 10, 2016

    @filipesilva
    Contributor

    This is a very relevant question. I don't think we support it in the CLI atm.

  2. added
    P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgent
    on Oct 10, 2016
  3. AshMcConnell commented on Oct 17, 2016

    @AshMcConnell

    +1 for lazy loading from a package

  4. lorenjerickson commented on Oct 26, 2016

    @lorenjerickson

    +1 here too, would love to be able to do this. working on a huge project with potentially dozens (hundreds?) of modules that may or may not ever be loaded, the decision is made at runtime. having them packaged as npm dependencies helps with the development process.

  5. tsluijter commented on Nov 9, 2016

    @tsluijter

    +1 for lazy loading from a package too

  6. odannyboy000 commented on Nov 10, 2016

    @odannyboy000

    +1 for lazy loading from a package

  7. modified the milestone: on Nov 11, 2016
  8. sclausen commented on Nov 12, 2016

    @sclausen

    +1

  9. Destreyf commented on Nov 14, 2016

    @Destreyf

    I'm not sure if its supposed to do it this way, but in my testing i'm setup with a nested lazy loading setup that has app -> admin -> content as the module tree, including a 3rd party module into the content module, this bundles the 3rd party module with my content module, so this could be a work around for this approach.

  10. sclausen commented on Nov 14, 2016

    @sclausen

    @Destreyf that sounds great. Could you be more specific on how you actually did it? For example provide a plunkr? That would be awesome.

  11. waltherp commented on Feb 17, 2017

    @waltherp

    +1

  12. captainkovalsky commented on Apr 5, 2017

    @captainkovalsky

    @Destreyf Yep, I did this in the same way, but what's about singleton services for a module ? As I understand when we provide a feature module from package the angular creates new instances of module. Am I right ?

  13. 29 remaining items

  14. klemenoslaj commented on Aug 1, 2018

    @klemenoslaj

    Issue is probably related to #6373 as well.

  15. micronyks commented on Aug 3, 2018

    @micronyks

    is there any update for this issue?
    I have also plenty of angular libraries which I use as packages and I want to lazy load them?

    I don't want to have a wrapper module which imports requires module from node_modules folder and then wrapper module can be lazy loaded.

    is it resolved in other referenced links?

    Will any one provide any update on this issue?

  16. klemenoslaj commented on Aug 3, 2018

    @klemenoslaj

    @micronyks, I researched the topic quite a lot (dozen of similar issues out there - unresolved) and it seems like this issue just receives no love :(
    I really depend on this right now, and it's making me rethink the whole ecosystem.

    Currently, the only way around this is really wrapping a module, but this is of course extremely bad.

  17. micronyks commented on Aug 3, 2018

    @micronyks

    First of all thanks for the update @klemenoslaj . Even I feel like that I am stuck after developing so many libraries and I don't want to go with a wrapper module approach.
    @filipesilva : Guys do you have any update on this issue?
    This issue is probably making people insane. Please provide a way or at least update in which release we should expect the resolution?

  18. wiikka commented on Aug 13, 2018

    @wiikka

    +1

  19. micronyks commented on Aug 21, 2018

    @micronyks

    Any Update?
    When should we expect this feature?
    Some information will really be helpful.

  20. Bhargavi-Kotagaram commented on Oct 15, 2018

    @Bhargavi-Kotagaram

    Hi,

    Me too got stuck with same issue, any update on this?

    Thanks,

  21. alan-agius4 commented on Nov 4, 2018

    @alan-agius4
    Collaborator

    Duplicate of #6373

  22. bionara commented on Nov 16, 2018

    @bionara

    Any updates on this issue?

  23. deepthan commented on Nov 19, 2018

    @deepthan

    this work for me, you can try it #6373

  24. angular-automatic-lock-bot commented on Sep 8, 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.

  25. locked and limited conversation to collaborators on Sep 8, 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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions