Start an App with Lazy Loading


#1

HI,

when I currently run ionic start mySuperApp super I will get a app without lazy loading.

The ionic-starter-super repo though has a branch with lazy loading and there are two blog post on the topic as well.

The fact that the starters do not use lazy loading at all lead to a few questions:

  • Is lazy loading ready and save to use with Ionic 3.5.0?
  • Is the way lazy loading is done about to change (breaking)?

I’m currently creating a PWA with 40+ pages and although I will use a script for the upgrade (generate the “.module.ts” files and do some other stuff) there will be quite some manual work left. So I simply want to be sure that it’s the right time to introduce lazy loading.

Overall I’m very pleased with Ionic and Angular and I’m looking forward what’s about to come for PWA’s in the near future.

So thanks and BR,
Michael

Cordova CLI: 6.5.0
Ionic CLI Version: 2.2.3
Ionic App Lib Version: 2.2.1
ios-deploy version: Not installed
ios-sim version: Not installed
OS: Windows 10
Node Version: v6.9.5
Xcode version: Not installed

#2

Yes.

If so, I haven’t heard of it. The main breaking change projected in Ionic 4 is that components will no longer be allowed to be dynamic. This is to play nicely with web components.

You’ll probably have more issues on the “progressive” side than the lazy loading side. Lots of projected functionality doesn’t exist yet, and might not for a while.


#3

The way URLs are mapped to navigation stack state should not be relied on to be stable (i.e. don’t use anchor href attributes), if you consider that part of “the way lazy loading is done”.


#4

@AaronSterling and @rapropos thanks for your answers.

Ionic does not use Github milestones on their public repository afaik. Is there any other way to keep track of upcoming features e.g. a roadmap? I would be really nice to have just a general overview whats about to come.


#5

One question I have forgotten to ask:

I organize my project by module rather than putting everything into a flat structure with “pages”, “components” or “providers” folders. Its easier to maintain the artifacts belonging to a module if they stay together.

  • Do you know of any problems if I organize my pages in a hierarchy like the one below while using lazy loading?

Project structure:

  • src
  • common
  • shared
  • modules
    • mod_a
      • pages
      • services
    • mod_b
      • pages
      • services

Without it it works fine.


#6

I’m not aware of one general link that provides updates. You can read the v4 branch of the ionic tree here. The most up-to-the-minute updates probably come from the ionitron twitter account, but I don’t follow it. I have an app that is close to alpha release, and I want “stable and works” at this point, not “latest and greatest.”

I don’t think it matters how you arrange your folders, as long as your import statements are correct. The general sense I get from this forum is that the standard ionic cli generator is good for a small app’s structure, but not for a large app’s structure, and several advanced posters use their own folder setup. So you can do whatever you want. However, if you haven’t read the official Angular Style Guide, I’d recommend it: folders by feature.