Folder-by-feature structure in Ionic?

Hi everyone,

I’ve found several posts talking about this and I’ve seen several people that were successful doing this, so I’m asking for some advice since I’m new to Ionic 3 (I’ve been working with Ionic 1 for almost 3 years).

We have a large Ionic 1 project organized by features. We have 2 levels of features: core features (the app needs them to work) and addons (they can be easily removed without affecting the app). Now we want to migrate it to Ionic 3.

This structure has worked fine for us so we want to keep a similar approach in Ionic 3, but I’ve seen a lot of people complaining about this. I did some basic tests and I was able to load pages from subfolders, but I soon found my first problem: images must be in the assets folder to work. We want our features to be self-contained, if an image is specific to a feature it should be inside that feature’s folder. Is there any way to achieve this? Do we need to create our own building system, or tweak the existing one, to copy assets from/to each feature folder?

Also, to make our addons features as independent as possible we created what we call “delegates”. For example, we have a delegate for side menu where addons can register themselves. Each addon registered in the delegate will be shown in the side menu, and clicking that link will open the addon’s main page. This way the core of the app doesn’t depend on the addons, and removing an addon will not break the app. Is something like this possible with Ionic 3?
EDIT: I did some tests for this and so far I’m unable to make it work. In Ionic 1 we used .config and .run to register the addons (example). I tried using APP_INITIALIZER, but it doesn’t seem to be executed, and my addon module isn’t run until I open its page (lazy loaded).

I hope someone with more experience can give us some advice with this :slight_smile:

Thanks,
Dani