Error: ./node_modules/@firebase/database/dist/index.cjs.js getting error in prod release mood for firebase angular2 in ionic 3

getting error when trying to build prod android i am using firebase and angular2 its show error like this
Error: ./node_modules/@firebase/database/dist/index.cjs.js
Module build failed: TypeError: Cannot read property ‘type’ of undefined
at Object.getEffectiveTypeAnnotationNode (D:\appDemo\tab\node_modules\typescript\lib\typescript.js:9341:17)
at assignContextualParameterTypes (D:\appDemo\tab\node_modules\typescript\lib\typescript.js:41652:25)
at checkFunctionExpressionOrObjectLiteralMethod (D:\appDemo\tab\node_modules\typescript\lib\typescript.js:41948:29)
at checkExpressionWorker (D:\appDemo\tab\node_modules\typescript\lib\typescript.js:42959:28)
at checkExpression (D:\appDemo\tab\node_modules\typescript\lib\typescript.js:42898:42)
at checkExpressionCached (D:\appDemo\tab\node_modules\typescript\lib\typescript.js:42779:38)
at checkReturnStatement (D:\appDemo\tab\node_modules\typescript\lib\typescript.js:45418:54)
at checkSourceElement (D:\appDemo\tab\node_modules\typescript\lib\typescript.js:46763:28)
at Object.forEach (D:\appDemo\tab\node_modules\typescript\lib\typescript.js:1506:30)
at checkBlock (D:\appDemo\tab\node_modules\typescript\lib\typescript.js:44563:16)
@ ./node_modules/firebase/dist/index.cjs.js 8:0-29
@ ./src/pages/account/account.ts
@ ./src/app/app.module.ts
@ ./src/app/app.module.ngfactory.js
@ ./src/app/main.ts
at BuildError.Error (native)
at new BuildError (D:\appDemo\tab\node_modules@ionic\app-scripts\dist\util\errors.js:16:28)
at callback (D:\appDemo\tab\node_modules@ionic\app-scripts\dist\webpack.js:121:28)
at emitRecords.err (D:\appDemo\tab\node_modules\webpack\lib\Compiler.js:265:13)
at Compiler.emitRecords (D:\appDemo\tab\node_modules\webpack\lib\Compiler.js:371:38)
at emitAssets.err (D:\appDemo\tab\node_modules\webpack\lib\Compiler.js:258:10)
at applyPluginsAsyncSeries1.err (D:\appDemo\tab\node_modules\webpack\lib\Compiler.js:364:12)
at next (D:\appDemo\tab\node_modules\tapable\lib\Tapable.js:218:11)
at Compiler.compiler.plugin (D:\appDemo\tab\node_modules\webpack\lib\performance\SizeLimitsPlugin.js:99:4)
at Compiler.applyPluginsAsyncSeries1 (D:\appDemo\tab\node_modules\tapable\lib\Tapable.js:222:13)

normally it is a import trouble, watch you account.ts file, may be Observable or Subject, in my case was
import * as firebase from ‘firebase’;
I imported like that due a problem getting firebase.firestore.FieldValue.serverTimestamp();
after a long search I found the correct way
import { firestore } from ‘@firebase/firestore’;
and get date simply as
firestore.FieldValue.serverTimestamp();

@Herdel

Are you using angularfire2 with your Ionic 3 App?

package.json

  "dependencies": {
    ...
    "@firebase/app": "0.1.10",
    ...
    "angularfire2": "5.0.0-rc.6",
    "firebase": "4.13.1",
    ...
    "ionic-angular": "3.9.2",
    "promise-polyfill": "7.1.2",
    ..
    "rxjs": "5.5.4"
    ...
  },

not in that project but I used in the past one, why?

I ran into some ‘type’ related issues when working on an Ionic 3 App using angularfire2.

I noticed your comment re firebase.firestore.FieldValue.serverTimestamp();

I went round and round in circles until I ended up with:

import { Injectable } from '@angular/core';

import {
  AngularFirestore,
  AngularFirestoreCollection,
  AngularFirestoreDocument
} from 'angularfire2/firestore';

import * as firebase from 'firebase/app';

import { Observable } from 'rxjs/Observable';

import { LoggerService } from '@core/logger/logger.service';

@Injectable()
export class DatabaseService {

  constructor(public afs: AngularFirestore,
              private logger: LoggerService) {
  }

  ...

  get timestamp() {
    return firebase.firestore.FieldValue.serverTimestamp();
  }

  ...


}

Notice the import * as firebase from 'firebase/app';

yes it depends on the version of node_modules firebase plugin version your using, I thing for that version you should import just:
import * as firebase from ‘firebase’;
try it and let us know :smiley:

Its an Ionic 3 PWA that uses the most recent version of angularfire2 (“5.0.0-rc.6”) that works with Angular 5.

Hence the need to use @firebase/app and import * as firebase from 'firebase/app'

package.json:

  "dependencies": {
    ...
    "@firebase/app": "0.1.10",
    ...
    "angularfire2": "5.0.0-rc.6",
    "firebase": "4.13.1",
    ...
    "ionic-angular": "3.9.2",
    "promise-polyfill": "7.1.2",
    ..
    "rxjs": "5.5.4"
    ...
  }