RC0 bundle dev failed: Module /src/pages/login/login.ts does not export LoginPage


#1

I found error after add login page

bundle dev failed:  Module /src/pages/login/login.ts does not export LoginPage (imported by /src/app/app.module.ts)
Error: Module /src/pages/login/login.ts does not export LoginPage (imported by /src/app/app.module.ts)

I’m create page Login for my default page using

ionic g page Login

Html, ts and scss file create on src\pages\login folder.

I’m import LoginPage in app.modules.ts and add LoginPage in declarations and entryComponents

import { LoginPage } from ‘…/pages/login/login’;

In my app.component.ts imposrt LoginPage and set rootPage = LoginPage.

import { LoginPage } from ‘…/pages/login/login’;
rootPage = LoginPage;

My ionic info

Cordova CLI: 6.3.1
Ionic Framework Version: 2.0.0-rc.0
Ionic CLI Version: 2.1.0
Ionic App Lib Version: 2.1.0-beta.1
OS:
Node Version: v6.7.0

Anyone can help me?
Thanks before :slight_smile:


#2

you also need to add the Login page in decleration and entryComponents inside app.module.ts


#3

I’m already add in decleration and entryComponents.

I’m confuse, if I remove import LoginPage inside app.module.ts error message remains the same.

This full error message;

at Module.trace (…\node_modules\rollup\dist\rollup.js:7706:29)
at ModuleScope.findDeclaration (…\node_modules\rollup\dist\rollup.js:7329:22)
at Scope.findDeclaration (…\node_modules\rollup\dist\rollup.js:5349:39)
at Scope.findDeclaration (…\node_modules\rollup\dist\rollup.js:5349:39)
at Identifier.bind …\node_modules\rollup\dist\rollup.js:6497:29)
at …\node_modules\rollup\dist\rollup.js:5149:50
at AssignmentExpression.eachChild (…\node_modules\rollup\dist\rollup.js:5166:5)
at AssignmentExpression.bind …\node_modules\rollup\dist\rollup.js:5149:7)
at AssignmentExpression.bind (…\node_modules\rollup\dist\rollup.js:5509:23)
at …\node_modules\rollup\dist\rollup.js:5149:50


#4

can you give the code in your app.module file here?


#5

app.module.ts:

import { NgModule } from ‘@angular/core’;
import { IonicApp, IonicModule } from ‘ionic-angular’;
import { MyApp } from ‘./app.component’;
import { AboutPage } from ‘…/pages/about/about’;
import { ContactPage } from ‘…/pages/contact/contact’;
import { HomePage } from ‘…/pages/home/home’;
import { TabsPage } from ‘…/pages/tabs/tabs’;
import { LoginPage } from ‘…/pages/login/login’;

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

app.component.ts:

import { Component } from ‘@angular/core’;
import { Platform } from ‘ionic-angular’;
import { StatusBar } from ‘ionic-native’;

//import { TabsPage } from ‘…/pages/tabs/tabs’;
import { LoginPage } from ‘…/pages/login/login’;

@Component({
template: <ion-nav [root]="rootPage"></ion-nav>
})
export class MyApp {
//rootPage = TabsPage;
rootPage = LoginPage;

constructor(platform: Platform) {
platform.ready().then(() => {
// Okay, so the platform is ready and our plugins are available.
// Here you can do any higher level native things you might need.
StatusBar.styleDefault();
});
}
}


#6

Can you share the code in your login.ts?


#7

login.ts

import { Component } from ‘@angular/core’;
import { NavController } from ‘ionic-angular’;
@Component({
selector: ‘page-login’,
templateUrl: ‘login.html’
})
export class Login {
constructor(public navCtrl: NavController) {}
ionViewDidLoad() {
console.log(‘Hello Login Page’);
}
}


#8

rename export class Login
into export class LoginPage


#9

Thanks Ellezo :grinning: :grin:


#10

Glad I helped a bit. Happy coding. :slightly_smiling_face: