title: Error: Type PdfViewerComponent in node_modules/ng2-pdf-viewer/ng2-pdf-viewer.d.ts is part of the declarations of 2 modules
body: <p>I got this error when trying <code>ionic cordova build android --prod --release</code>, using <code>ionic serve</code> or <code>ionic cordova run android</code> the app works good.</p>
  
  <blockquote>
    <p>Error: Type PdfViewerComponent in C:/app/node_modules/ng2-pdf-viewer/ng2-pdf-viewer.d.ts is part of the declarations of 2 modules: PdfViewerModule in C:/app/node_modules/ng2-pdf-viewer/ng2-pdf-viewer.d.ts and PdfModalPageModule in C:/app/src/pages/document-pdf/document-pdf.module.ts! Please consider moving PdfViewerComponent in C:/app/node_modules/ng2-pdf-viewer/ng2-pdf-viewer.d.ts to a higher module that imports PdfViewerModule in C:/app/node_modules/ng2-pdf-viewer/ng2-pdf-viewer.d.ts and PdfModalPageModule in C:/app/src/pages/document-pdf/document-pdf.module.ts. You can also create a new NgModule that exports and includes PdfViewerComponent in C:/app/node_modules/ng2-pdf-viewer/ng2-pdf-viewer.d.ts then import that NgModule in PdfViewerModule in C:/app/node_modules/ng2-pdf-viewer/ng2-pdf-viewer.d.ts and PdfModalPageModule in C:/app/src/pages/document-pdf/document-pdf.module.ts.</p>
  </blockquote>
  
  <p>I only import ng-pdf-viewer in <code>document-pdf.module.ts</code> not in app.module.ts</p>
  
  <pre><code>import {NgModule} from '@angular/core';
  import {IonicPageModule} from 'ionic-angular';
  import {PdfModalPage} from "./document-pdf";
  import {PdfViewerComponent} from "ng2-pdf-viewer";
  
  @NgModule({
      declarations: [PdfModalPage, PdfViewerComponent],
      imports: [IonicPageModule.forChild(PdfModalPage)],
  })
  export class PdfModalPageModule {}
  </code></pre>
  
  <p>angular &amp; ionic version</p>
  
  <pre><code>{
    "name": "Test",
    "version": "0.0.1",
    "description": "",
    "license": "Apache-2.0",
    "scripts": {
      "build": "ionic-app-scripts build",
      "clean": "ionic-app-scripts clean",
      "ionic:build": "ionic-app-scripts build",
      "ionic:serve": "ionic-app-scripts serve",
      "i18n": "ng-xi18n"
    },
    "dependencies": {
      "@angular/common": "4.4.6",
      "@angular/compiler": "4.4.6",
      "@angular/compiler-cli": "4.4.6",
      "@angular/core": "4.4.6",
      "@angular/forms": "4.4.6",
      "@angular/http": "4.4.6",
      "@angular/platform-browser": "4.4.6",
      "@angular/platform-browser-dynamic": "4.4.6",
      "@ionic-native/app-version": "4.5.2",
      "@ionic-native/background-mode": "^4.5.3",
      "@ionic-native/contacts": "4.5.2",
      "@ionic-native/core": "3.14.0",
      "@ionic-native/device": "4.5.2",
      "@ionic-native/diagnostic": "^4.5.2",
      "@ionic-native/file": "4.5.2",
      "@ionic-native/file-chooser": "4.5.2",
      "@ionic-native/file-path": "4.5.2",
      "@ionic-native/firebase": "^4.5.3",
      "@ionic-native/in-app-browser": "3.14.0",
      "@ionic-native/media": "4.5.2",
      "@ionic-native/media-capture": "4.5.2",
      "@ionic-native/network": "^4.5.2",
      "@ionic-native/onesignal": "4.5.2",
      "@ionic-native/screen-orientation": "4.5.2",
      "@ionic-native/sim": "4.5.2",
      "@ionic-native/splash-screen": "3.14.0",
      "@ionic-native/sqlite": "^4.5.2",
      "@ionic-native/status-bar": "3.14.0",
      "@ionic-native/unique-device-id": "4.5.2",
      "@ionic-native/video-editor": "^4.5.2",
      "@ionic-native/video-player": "^4.5.2",
      "@ionic/pro": "^1.0.16",
      "@ionic/storage": "2.0.1",
      "angular2-moment": "1.7.0",
      "angular2-signaturepad": "2.6.1",
      "angularfire2": "^5.0.0-rc.3",
      "com-badrit-base64": "^0.2.0",
      "cordova-android": "^6.4.0",
      "cordova-ios": "^4.5.4",
      "cordova-plugin-app-version": "^0.1.9",
      "cordova-plugin-background-mode": "^0.7.2",
      "cordova-plugin-compat": "^1.2.0",
      "cordova-plugin-console": "^1.1.0",
      "cordova-plugin-contacts": "^2.3.1",
      "cordova-plugin-device": "^1.1.7",
      "cordova-plugin-file": "^4.3.3",
      "cordova-plugin-filechooser": "^1.0.1",
      "cordova-plugin-filepath": "^1.2.0",
      "cordova-plugin-firebase": "^0.1.25",
      "cordova-plugin-inappbrowser": "^1.7.2",
      "cordova-plugin-ionic": "^3.1.0",
      "cordova-plugin-media": "^3.0.1",
      "cordova-plugin-media-capture": "^1.4.3",
      "cordova-plugin-network-information": "^2.0.1",
      "cordova-plugin-screen-orientation": "^2.0.2",
      "cordova-plugin-sim": "^1.3.3",
      "cordova-plugin-splashscreen": "^4.1.0",
      "cordova-plugin-statusbar": "^2.4.1",
      "cordova-plugin-video-editor": "^1.1.3",
      "cordova-plugin-whitelist": "^1.3.3",
      "cordova-sqlite-storage": "^2.2.0",
      "cordova.plugins.diagnostic": "^3.9.2",
      "es6-promise-plugin": "^4.2.2",
      "firebase": "^4.9.1",
      "ionic-angular": "3.9.2",
      "ionic-plugin-keyboard": "^2.2.1",
      "ionic2-auto-complete": "1.6.2-alpha",
      "ionicons": "3.0.0",
      "ng2-pdf-viewer": "4.1.0",
      "ng2-timeago": "1.0.7",
      "onesignal-cordova-plugin": "^2.2.5",
      "rxjs": "5.5.5",
      "sw-toolbox": "3.6.0",
      "zone.js": "0.8.18"
    },
    "devDependencies": {
      "@ionic/app-scripts": "^3.1.8",
      "ionic": "3.19.1",
      "typescript": "2.6.2"
    },
    "config": {},
    "cordova": {
      "platforms": [
        "android",
        "ios"
      ],
      "plugins": {
        "cordova-plugin-console": {},
        "cordova-plugin-device": {},
        "cordova-plugin-inappbrowser": {},
        "cordova-plugin-splashscreen": {},
        "cordova-plugin-statusbar": {},
        "cordova-plugin-whitelist": {},
        "ionic-plugin-keyboard": {},
        "cordova-plugin-file": {},
        "cordova-plugin-filechooser": {},
        "cordova-plugin-app-version": {},
        "cordova-plugin-filepath": {},
        "onesignal-cordova-plugin": {},
        "cordova-plugin-media-capture": {},
        "cordova-plugin-screen-orientation": {},
        "cordova-plugin-media": {},
        "cordova-plugin-contacts": {},
        "cordova-plugin-sim": {},
        "com-badrit-base64": {},
        "cordova-plugin-network-information": {},
        "cordova-plugin-video-editor": {},
        "cordova-sqlite-storage": {},
        "cordova.plugins.diagnostic": {},
        "cordova-plugin-firebase": {},
        "cordova-plugin-background-mode": {}
      }
    }
  }
  </code></pre>
  
  <p>ionic info</p>
  
  <pre><code>cli packages: (C:\app\node_modules)
  @ionic/cli-utils  : 1.19.1
  ionic (Ionic CLI) : 3.19.1
  
  global packages:
  cordova (Cordova CLI) : 7.1.0
  
  local packages:
  @ionic/app-scripts : 3.1.8
  Cordova Platforms  : android 6.4.0
  Ionic Framework    : ionic-angular 3.9.2
  </code></pre>
  
  <p>I tried with a fresh install deleting /platforms /www /plugins and /node_modules</p>