Problems with build --prod

Hello, I need help with my app when making a build --prod.

In the app I have created two modules, one for a home screen (login) and another module for the application itself.

Well when doing a build --prod, it gives me the following error:

error NG8001: 'ion-router-outlet' is not a known element

can anybody help me?

Typically this means you didn’t add the IonicModule declaration to an ngModule.

If you have a demo app to provide, that will help too.

1 Like

Thanks for the reply, I’m sorry I didn’t answer before …
I understand that you mean that you have to put in the two modules the directive

IonicModule.forRoot ()

in the imports array, right?
I thought that just using it in the main was enough …

No, it needs to be in both modules.
This is how angular expects modules to work.

See our starter projects here


Even though the root app.module has IonicModule.forRoot(), the 2 other modules also include a IonicModule statement as well


I tried to put the IonicModule line in the Dashboard module and I tried to build --prod and it works perfectly …

Thank you!