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.