New page Created Module.ts file

Hi Everyone.

I’ve an issue. When I run ionic page command in ionic 2 blank project to create a new its creates 4 files.
For example if i run ionic g page about it makes a about folder containing 4 files
about.html
about.scss
about.ts
and the last one about.module.ts

Please guide me why this about.module.ts is being created

Thanks

3 Likes

Unless you have a solid understanding of what it is doing, I recommend simply deleting it.

Well… I did it already. But I’m supersized why Its been created.

I have the same problem , also in app.module.ts couldn’t find the page that I created it

Well For That You Have to manually add the page in app.module.ts… A

2 Likes

Hi, @mk0547

Could you try

ionic genrate page “pagename”

Hope this will work for you. If you find it helpful then you can mark it as a solution. You can always like the answer by clicking on heart icon.

3 Likes

That file is for ionic 3

1 Like

@williamdelvalle Thanks for replying. Can you please guide me about it more. coz my project is in ionic 2. and I’m not understanding its relation with ionic 3

@mk0547 Show me the result of the ionic info command

I have the same problem The project is created with version 2. I have another project created last week and with the same function does not happen. It only happens with the creation of a new project. Thanks

@williamdelvalle Please see… and guide Thanks

Cordova CLI: Not installed
Ionic CLI Version: 2.2.1
Ionic App Lib Version: 2.2.0
ios-deploy version: Not installed
ios-sim version: Not installed
OS: Windows 8.1
Node Version: v6.10.0
Xcode version: Not installed

One thing is surprized for me in it I’ve installed cordova if run cordova -v its telling me cordova version 6.5.0 but ionic info says Cordova CLI not installed

You could reinstall cordova again and try again please.

npm install -g cordova

1 Like

You can ignore the module.ts files.

I’m not so sure about that. You have to decide whether you want in on the lazy page loading or not, and if you leave them there they will opt you in. Unless you’re convinced that it’s going to have a net beneficial impact, my current position is that it’s best to delete that file and remove the IonicPageModule decorator from pages.

1 Like

@rapropos Agreed. For example, I’m in the middle of fully porting my project over to the latest Ionic code base and will be doing performance testing to see if all on only certain pages warrant lazy loading. Until that testing is done I can’t just generalise or simply ignore certain features / code.

In my experience, Angular 4 and ionic-native 3 on their own offer significant bundle size reductions (and corresponding startup time minimization). Lazy page loading, OTOH, is a rather mixed bag at the moment.

I’m sure there’s a compromise vs, balance vs. benefit at the moment. I’m sure it’ll all even out in the end. We just need to make intelligent, informed decisions on when to use which features as well as thoughtful application structure / design decisions. This can take time but I’ve found it’s saved me more time in the long run than it’s cost me.

I think a viable heuristic at the moment is as follows:

If all of your pages are truly completely independent of one another and the primary landing page is relatively light, lazy page loading might be worth looking into. If you have custom components that are shared by multiple pages or your landing page is relatively heavy compared to your other pages, it’s probably not recommended.

@williamdelvalle I did what you said and it works well, many thanks :slight_smile:

@mk0547 for more explanation, previously we add the page to app.module.ts, and import it when we need to navigate to it from some page… in ionic 3 you don’t need to do that even if your app is use ionic 2 you could just navigate to ionic 3 page by putting the page name as string like this
this.navCtrl.push(‘Registration’); // Registration is my new page using ionic 3 generated page

try to update cordova as @williamdelvalle said… it does work after updating cordova