Ionic 3 import guide?

How to handle imports in Ionic 3?
Would be super if someone made a guide to show how to import classes , providers, pipes and so on.

A guide to importing classes, providers, pipes and so on in Ionic 3

Do the exact same thing you did in Ionic 2. In fact, “Ionic 3” isn’t really even a very useful phrase.

But we got a new module for every page and I havent figured out if I should make the import there or in the main app module.

My advice (especially for you) with the current state of affairs is to delete all [page].module.ts, remove the @IonicPageModule decorator from all your pages, and put everything in the main app module as you have been doing all along.

I say “especially for you” because the lazy page loading system works much better ATM with apps who share no custom components or pipes amongst pages, and if you’re asking about where to be importing things, that suggests to me that you are using the same custom resources in multiple pages. If you enable lazy page loading, each page module will end up with its own private copy of all that code, which can seriously bloat your app package.

I would avoid lazy page loading until somebody resolves that issue.

1 Like