CustomMenu doesn't show in prod


#1

I have a custom menu and custom header created and published in npm. In other project I import those elements and header is shown but when I clicked in the menu button it doesn’t show the menu.
The error in console is this:

ERROR Error: Uncaught (in promise): TypeError: menuTypes[type] is not a constructor
TypeError: menuTypes[type] is not a constructor
    at Function.MenuController.create (main.js:47449)
    at Menu._getType (main.js:73100)
    at main.js:73122
    at new t (polyfills.js:3)
    at Menu.setOpen (main.js:73120)
    at Menu.toggle (main.js:73290)
    at MenuToggle.toggle (main.js:93544)
    at Object.handleEvent (main.js:78096)
    at Object.handleEvent (main.js:12290)
    at Object.handleEvent (main.js:13014)
    at Function.MenuController.create (main.js:47449)
    at Menu._getType (main.js:73100)
    at main.js:73122
    at new t (polyfills.js:3)
    at Menu.setOpen (main.js:73120)
    at Menu.toggle (main.js:73290)
    at MenuToggle.toggle (main.js:93544)
    at Object.handleEvent (main.js:78096)
    at Object.handleEvent (main.js:12290)
    at Object.handleEvent (main.js:13014)
    at c (polyfills.js:3)
    at new t (polyfills.js:3)
    at Menu.setOpen (main.js:73120)
    at Menu.toggle (main.js:73290)
    at MenuToggle.toggle (main.js:93544)
    at Object.handleEvent (main.js:78096)
    at Object.handleEvent (main.js:12290)
    at Object.handleEvent (main.js:13014)
    at dispatchEvent (main.js:8883)
    at main.js:9494

It only happens in production. I am running ionic cordova run android --aot to see errors without minification.

The module of the npm project is this:

import { NgModule, ModuleWithProviders } from '@angular/core';
import { IonicModule } from 'ionic-angular';

import { CustomHeader } from "./components/extended/header/header";
import { CustomMenu } from "./components/extended/menu/menu";
import { MenuService } from "./components/extended/menu/menu.service";

@NgModule({
  imports: [
    IonicModule.forRoot(CustomHeader),
    IonicModule.forRoot(CustomMenu)
  ],
  exports: [
    CustomHeader,
    CustomMenu
  ],
  declarations: [
    CustomHeader,
    CustomMenu
  ],
  entryComponents: [
    CustomHeader,
    CustomMenu
  ],
  providers: [
    MenuService
  ],
})
export class ComponentsModule {

}

And the module where I imported the project:

import { NgModule, ErrorHandler } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { IonicApp, IonicModule, IonicErrorHandler } from 'ionic-angular';
import { MyApp } from './app.component';

import { HomePage } from '../pages/home/home';
import { StatusBar } from '@ionic-native/status-bar';
import { SplashScreen } from '@ionic-native/splash-screen';
import { ComponentsModule } from 'components';



@NgModule({
  declarations: [
    MyApp,
    HomePage
  ],
  imports: [
    BrowserModule,
    ComponentsModule,
    IonicModule.forRoot(MyApp)
  ],
  bootstrap: [IonicApp],
  entryComponents: [
    MyApp,
    HomePage
  ],
  providers: [
    StatusBar,
    SplashScreen,
    {provide: ErrorHandler, useClass: IonicErrorHandler}
  ]
})
export class AppModule {}

Someone know what is happening?
Thank you.