Skip to content

Generating web+mobile NgModules doesn't work in some code-sharing apps #202

Open
@sis0k0

Description

@sis0k0

Environment
Provide the content of the package.json file in the project:

{
  "name": "WebMobileProject",
  "license": "SEE LICENSE IN <your-license-filename>",
  "version": "0.0.0",
  "nativescript": {
    "id": "org.nativescript.webmobileproject",
    "tns-android": {
      "version": "5.2.1"
    }
  },
  "scripts": {
    "android": "tns run android --bundle",
    "ios": "tns run ios --bundle",
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
  "dependencies": {
    "@angular/animations": "~7.2.0",
    "@angular/common": "~7.2.0",
    "@angular/compiler": "~7.2.0",
    "@angular/core": "~7.2.0",
    "@angular/forms": "~7.2.0",
    "@angular/http": "~7.2.0",
    "@angular/platform-browser": "~7.2.0",
    "@angular/platform-browser-dynamic": "~7.2.0",
    "@angular/router": "~7.2.0",
    "nativescript-angular": "~7.2.0",
    "nativescript-theme-core": "~1.0.4",
    "reflect-metadata": "~0.1.8",
    "rxjs": "~6.4.0",
    "tns-core-modules": "~5.2.0",
    "zone.js": "~0.8.2"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "~0.13.0",
    "@angular/cli": "~7.3.0",
    "@angular/compiler-cli": "~7.2.0",
    "@nativescript/schematics": "^0.5.1",
    "nativescript-dev-webpack": "~0.20.0",
    "typescript": "~3.1.0"
  }
}

Describe the bug
When executing the command ng generate module somename in a code-sharing project, the following files should be generated:

  • somename.module.ts - web NgModule
  • somename.module.tns.ts - mobile NgModule
  • somename.common.ts - shared file

However, only the web NgModule is generated. The behaviour is the same even if it's specified explicitly that both modules should be generated:

ng generate module somename --web=true --nativescript=true

To Reproduce

ng generate module somename

or

ng generate module somename --web=true --nativescript=true

Expected behavior
All three files should be generated and the command flags should be respected.

Sample project
I observed the behaviour in https://github.com/nativescript/web-mobile-project.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions