_From @danielehrhardt on July 12, 2017 0:44_
ionic g page name
-->
C:\Users\Daniel\Desktop\Alles\Projekte\Contacts\contacts-app\src\pages\search-overview\search-overview.ts
has a @IonicPage decorator, but it does not have a corresponding "NgModule" at
C:\Users\Daniel\Desktop\Alles\Projekte\Contacts\contacts-app\src\pages\search-overview\search-overview.module.ts
_Copied from original issue: ionic-team/ionic-cli#2511_
_From @saimon24 on July 12, 2017 5:20_
Yes I can confirm this, latest version is not creating a module file for pages anymore.
This is on purpose. We still need to update the templates before we release 3.5.1 though.
We did this because the base starters are not setup for lazy loading. Which is fine, but when a new user tries to generate a new page, they'll get ngModule and @IonicPage right away. Since this can be confusing, we disabled the auto-generation of ngModule for the time being. I hope to have a more interactive setup soon that will prompt the user if they want this page lazy loaded or not.
So this is only a temporary problem until 3.5.1 is released which updates the templates (that are used to generate a page) to not include @IonicPage any more, right?
Correct
Mike Hartington
On Jul 12, 2017, at 5:58 AM, Jan Piotrowski notifications@github.com wrote:
So this is only a temporary problem until 3.5.1 is released which updates the templates (that are used to generate a page) to not include @IonicPage any more, right?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or mute the thread.
Yes, i understand. Thank you for your fast reply on this.
Lazy loading is generally a great feature. My understanding is that right now after 3.5.1 when we do ionic g page the page by default will be added as a non lazy loading page, is that correct? Wouldn't it be better to have it generated with a NgModule and for it to be lazy loaded?
This is the goal, yes. But as the generated lazy-loaded enabled pages didn't work out of the box with the Ionic starter templates, it was better to disable them for now.
The option to generate lazy loaded pages will come back, better. If you want to use the current generator and then make the pages lazy-loaded (as before), see this forum post where I explain the necessary changes: https://forum.ionicframework.com/t/how-to-make-the-non-lazy-loaded-generated-pages-loazy-loaded-again/98102?u=sujan12
Would it be valuable to add an option like --lazyload to do the lazy load on generate for page and tab in the time until it is fully implemented later? It seems like it would ease confusion. Especially for those who are going through up to date tutorials that tell them that a module file will be generated for lazy loading. I would be happy to submit a PR for this if it is desired functionality.
Something like that will be implemented.
This is actually not that easy because three parties are working here: ionic (CLI) is running the command, @ionic/app-scripts is generating the files that it gets from the templates folder inside ionic-angular. Right now there is only one template for a page.
Also you would have to get the starter project working with lazy loaded pages by default to not be in the state from before the change. And that was considered "bad enough" to go back to non-lazy loaded.
I understand the difficulty. I am willing to go through the effort. It's a way for me to get my feet wet in the source anyway.
I do not understand the last thing you mentioned. The starter projects would not change. They would still work if someone did ionic g without the --lazyload option. It seems intuitive to me that if a new user uses the --lazyload option without knowledge of how lazyload works, then that user should expect to have to do some research on it.
yesterday i was scared when starting a new project in a hurry realized that the lazy loading is not generated by default in cli. First thought i had was that lazy loading was removed due to the issues it has, and that was scary enough.
I tried to quickly find a reference on this topic and realized that i was not aware of a place where important architecture decisions on ionic 2-3 is available.
I might be wrong and I hope there is one. Maybe someone can help with a link to it, since is not so visible on the main website/git.
Just to comment on this again, We will be adding the functionality back.
Since the default starter templates were not lazy loaded, generating a new page that was lazy loaded ended up causing issues out of the box. Since most users were not using lazy loading out of the box, the temporary removal of this addressed this.
When we add the functionality back, there will be a new prompt asking devs if they want the page to be lazy loaded.
As far as looking for architecture decisions, I wrote about these on the ionic blog.
http://blog.ionic.io/ionic-and-lazy-loading-pt-2/
Closing for now.
Most helpful comment
This is on purpose. We still need to update the templates before we release 3.5.1 though.
We did this because the base starters are not setup for lazy loading. Which is fine, but when a new user tries to generate a new page, they'll get ngModule and
@IonicPageright away. Since this can be confusing, we disabled the auto-generation of ngModule for the time being. I hope to have a more interactive setup soon that will prompt the user if they want this page lazy loaded or not.