Skip to content
This repository was archived by the owner on May 1, 2020. It is now read-only.
This repository was archived by the owner on May 1, 2020. It is now read-only.

@ionicPage module resolution issue with component file naming #1093

Open
@sinedied

Description

@sinedied

Short description of the problem:

When naming my page components following the Angular Style Guide conventions, for example home.page.ts (or home.component.ts) and use @ionicPage decorator, I get an error:

[13:00:14]  ionic-app-script task: "serve" 
[13:00:14]  Error: /Users/noda/github/ngx-starter-kit/src/app/home/home.component.ts has a @IonicPage decorator, but it 
            does not have a corresponding "NgModule" at 
            /Users/noda/github/ngx-starter-kit/src/app/home/home.component.module.ts 

I have the corresponding module, but it's named home.module.ts, so there is an issue with the name resolution mechanism.

What behavior are you expecting?

Using home.ts, home.page.ts or home.component.ts should resolve to home.module.ts.
Or if it can't be done automatically by the script, add a config option pageSuffix or equivalent so we can configure the suffix we use for page components.

Steps to reproduce:

  1. Create new ionic project, for example using the sidemenu starter.
  2. Rename src/pages/home/home.ts to home.page.ts and add @ionicPages decorator on it and fixe references to it in app.module.ts and app.component.ts
  3. Add corresponding src/pages/home/home.module.ts:
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { IonicPageModule } from 'ionic-angular';

import { HomePage } from './home.page';

@NgModule({
  imports: [
    CommonModule,
    IonicPageModule.forChild(HomePage)
  ],
  declarations: [HomePage],
  entryComponents: [HomePage]
})
export class HomeModule { }

Which @ionic/app-scripts version are you using?
"@ionic/app-scripts": "^2.0.0",

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions