External custom module is not recognised by NgModule in the upgrade to Ionic2RC0


#1

The building of my files goes well, but I get the following error message in the console is:

Unexpected value ‘MyComponentModule’ imported by the module ‘AppModule’

I created a npm module that contains my components that I import into my App. The system worked fine up to Ionic2beta11, but by using this module approach we met this error.

As we use this code directly in our App, it works fine:

import * as core from "frontend-core";

@core.Angular.Component({
   selector: "my-component",
   template: `<h1>This is my Component</h1>`
})
class MyComponent { }

@core.Angular.NgModule({
 declarations: [ MyComponent ],
 exports:      [ MyComponent ]
})
export class MyComponentModule { }

But as we place this code in our external Components module (the one named as ‘my-component’), it throws the mentioned error in the browser console

import { MyComponentModule } from 'my-components';

import { MyApp } from './app.component';
import { HomePage } from '../pages/home/home';

@NgModule({
   declarations: [
       MyApp,
       HomePage
   ],
   imports: [
       MyComponentModule,
       IonicModule.forRoot(MyApp)
   ],
   bootstrap: [IonicApp],
   entryComponents: [
       MyApp,
       HomePage
   ],
   providers: []
})
export class AppModule {}

The folder structure is:

src
--- app
    app.component.ts
    app.module.ts
    main.dev.ts
node-modules
--- my-components
     index.ts

index.ts contains my module.

The tsconfig.json and packages.json files are the same copied from the ionic2rc upgrade, typings has been removed as well.


Unexpected value 'Ng2CompleterModule' imported by the module 'AppModule'
#2

Nobody knows about it? It is a relevant issue I must say, since I have a lot of custom components placed in an external module


#3

I too am having this issue for a number of external modules in my project. I’ve seen a handful of others asking about it but still no solution :frowning: