Error on production build

Hi all,

I’m getting the following error when doing: ionic build --prod

Error: ./src/pages/home/home.ngfactory.js
Module not found: Error: Can't resolve '../../../angularfire2/database' in '[myPath]\src\pages\home'
resolve '../../../angularfire2/database' in '[myPath]\src\pages\home'
  using description file: [myPath]\package.json (relative path: ./src/pages/home)
    Field 'browser' doesn't contain a valid alias configuration
  after using description file: [myPath]\package.json (relative path: ./src/pages/home)
    using description file: [myPath]\package.json (relative path: ./angularfire2/database)
      no extension
        Field 'browser' doesn't contain a valid alias configuration
        [myPath]\angularfire2\database doesn't exist
      .js
        Field 'browser' doesn't contain a valid alias configuration
        [myPath]\angularfire2\database.js doesn't exist
      .ts
        Field 'browser' doesn't contain a valid alias configuration
        [myPath]\angularfire2\database.ts doesn't exist
      as directory
        [myPath]\angularfire2\database doesn't exist
[[myPath]\angularfire2\database]
[[myPath]\angularfire2\database.js]
[[myPath]\angularfire2\database.ts]
[[myPath]\angularfire2\database]
 @ ./src/pages/home/home.ngfactory.js 41:0-59
 @ ./src/app/app.module.ngfactory.js
 @ ./src/app/main.ts,./src/app/app.module.ngfactory.js
Module not found: Error: Can't resolve '../../angularfire2/database' in '[myPath]\src\app'
resolve '../../angularfire2/database' in '[myPath]\src\app'
  using description file: [myPath]\package.json (relative path: ./src/app)
    Field 'browser' doesn't contain a valid alias configuration
  after using description file: [myPath]\package.json (relative path: ./src/app)
    using description file: [myPath]\package.json (relative path: ./angularfire2/database)
      no extension
        Field 'browser' doesn't contain a valid alias configuration
        [myPath]\angularfire2\database doesn't exist
      .js
        Field 'browser' doesn't contain a valid alias configuration
        [myPath]\angularfire2\database.js doesn't exist
      .ts
        Field 'browser' doesn't contain a valid alias configuration
        [myPath]\angularfire2\database.ts doesn't exist
      as directory
        [myPath]\angularfire2\database doesn't exist
[[myPath]\angularfire2\database]
[[myPath]\angularfire2\database.js]
[[myPath]\angularfire2\database.ts]
[[myPath]\angularfire2\database]
 @ ./src/app/app.module.ngfactory.js 29:0-56
 @ ./src/app/main.ts

How can I solve this problem?

I think is was because Firebase itself wasn’t installed right or not found.

npm install firebase angularfire2 --save

It’s an issue with angularfire2. If you search for it here in the forum you will find multiple topics about it, some also having a suggested solution (using rc1 instead of rc2 I think)