angularfire: Ionic production build fails.

Version info

Angular: 4.1.3 Firebase: 4.3.0 AngularFire: 4.0.0-rc.2 Other (e.g. Ionic/Cordova, Node, browser, operating system): ionic 3.9.2

How to reproduce these conditions

Failing test unit, Plunkr, or JSFiddle demonstrating the problem

Steps to set up and reproduce Started a new project following the guide at [https://github.com/angular/angularfire2/blob/master/docs/Auth-with-Ionic3-Angular4.md]

Doing a dev build with ‘ionic build’ or testing the app with ‘ionic serve’ works fine. But as soon as I add the ‘–prod’ switch to the build command, it fails.

Sample data and security rules

<-- include/attach/link to some json sample data (or provide credentials to a sanitized, test Firebase project) -->

Debug output

Error: ./src/pages/login/login.ngfactory.js Module not found: Error: Can’t resolve ‘…/…/…/angularfire2/auth’ in ‘D:\Makin gChoices.be\MobileApps\Apps\OHAMBO\src\pages\login’ resolve ‘…/…/…/angularfire2/auth’ in ‘D:\MakingChoices.be\MobileApps\Apps\OHA MBO\src\pages\login’ using description file: D:\MakingChoices.be\MobileApps\Apps\OHAMBO\package.jso n (relative path: ./src/pages/login) Field ‘browser’ doesn’t contain a valid alias configuration after using description file: D:\MakingChoices.be\MobileApps\Apps\OHAMBO\packa ge.json (relative path: ./src/pages/login) using description file: D:\MakingChoices.be\MobileApps\Apps\OHAMBO\package.j son (relative path: ./angularfire2/auth) no extension Field ‘browser’ doesn’t contain a valid alias configuration D:\MakingChoices.be\MobileApps\Apps\OHAMBO\angularfire2\auth doesn’t exi st .js Field ‘browser’ doesn’t contain a valid alias configuration D:\MakingChoices.be\MobileApps\Apps\OHAMBO\angularfire2\auth.js doesn’t exist .ts Field ‘browser’ doesn’t contain a valid alias configuration D:\MakingChoices.be\MobileApps\Apps\OHAMBO\angularfire2\auth.ts doesn’t exist as directory D:\MakingChoices.be\MobileApps\Apps\OHAMBO\angularfire2\auth doesn’t exi st [D:\MakingChoices.be\MobileApps\Apps\OHAMBO\angularfire2\auth] [D:\MakingChoices.be\MobileApps\Apps\OHAMBO\angularfire2\auth.js] [D:\MakingChoices.be\MobileApps\Apps\OHAMBO\angularfire2\auth.ts] [D:\MakingChoices.be\MobileApps\Apps\OHAMBO\angularfire2\auth] @ ./src/pages/login/login.ngfactory.js 39:0-55 @ ./src/app/app.module.ngfactory.js @ ./src/app/main.ts,./src/app/app.module.ngfactory.js Module not found: Error: Can’t resolve ‘…/…/angularfire2/auth’ in ‘D:\MakingCh oices.be\MobileApps\Apps\OHAMBO\src\app’ resolve ‘…/…/angularfire2/auth’ in ‘D:\MakingChoices.be\MobileApps\Apps\OHAMBO \src\app’ using description file: D:\MakingChoices.be\MobileApps\Apps\OHAMBO\package.jso n (relative path: ./src/app) Field ‘browser’ doesn’t contain a valid alias configuration after using description file: D:\MakingChoices.be\MobileApps\Apps\OHAMBO\packa ge.json (relative path: ./src/app) using description file: D:\MakingChoices.be\MobileApps\Apps\OHAMBO\package.j son (relative path: ./angularfire2/auth) no extension Field ‘browser’ doesn’t contain a valid alias configuration D:\MakingChoices.be\MobileApps\Apps\OHAMBO\angularfire2\auth doesn’t exi st .js Field ‘browser’ doesn’t contain a valid alias configuration D:\MakingChoices.be\MobileApps\Apps\OHAMBO\angularfire2\auth.js doesn’t exist .ts Field ‘browser’ doesn’t contain a valid alias configuration D:\MakingChoices.be\MobileApps\Apps\OHAMBO\angularfire2\auth.ts doesn’t exist as directory D:\MakingChoices.be\MobileApps\Apps\OHAMBO\angularfire2\auth doesn’t exi st [D:\MakingChoices.be\MobileApps\Apps\OHAMBO\angularfire2\auth] [D:\MakingChoices.be\MobileApps\Apps\OHAMBO\angularfire2\auth.js] [D:\MakingChoices.be\MobileApps\Apps\OHAMBO\angularfire2\auth.ts] [D:\MakingChoices.be\MobileApps\Apps\OHAMBO\angularfire2\auth] @ ./src/app/app.module.ngfactory.js 32:0-52 @ ./src/app/main.ts,./src/app/app.component.ngfactory.js Module not found: Error: Can’t resolve ‘…/…/angularfire2/auth’ in ‘D:\MakingCh oices.be\MobileApps\Apps\OHAMBO\src\app’ resolve ‘…/…/angularfire2/auth’ in ‘D:\MakingChoices.be\MobileApps\Apps\OHAMBO \src\app’ using description file: D:\MakingChoices.be\MobileApps\Apps\OHAMBO\package.jso n (relative path: ./src/app) Field ‘browser’ doesn’t contain a valid alias configuration after using description file: D:\MakingChoices.be\MobileApps\Apps\OHAMBO\packa ge.json (relative path: ./src/app) using description file: D:\MakingChoices.be\MobileApps\Apps\OHAMBO\package.j son (relative path: ./angularfire2/auth) no extension Field ‘browser’ doesn’t contain a valid alias configuration D:\MakingChoices.be\MobileApps\Apps\OHAMBO\angularfire2\auth doesn’t exi st .js Field ‘browser’ doesn’t contain a valid alias configuration D:\MakingChoices.be\MobileApps\Apps\OHAMBO\angularfire2\auth.js doesn’t exist .ts Field ‘browser’ doesn’t contain a valid alias configuration D:\MakingChoices.be\MobileApps\Apps\OHAMBO\angularfire2\auth.ts doesn’t exist as directory D:\MakingChoices.be\MobileApps\Apps\OHAMBO\angularfire2\auth doesn’t exi st [D:\MakingChoices.be\MobileApps\Apps\OHAMBO\angularfire2\auth] [D:\MakingChoices.be\MobileApps\Apps\OHAMBO\angularfire2\auth.js] [D:\MakingChoices.be\MobileApps\Apps\OHAMBO\angularfire2\auth.ts] [D:\MakingChoices.be\MobileApps\Apps\OHAMBO\angularfire2\auth] @ ./src/app/app.component.ngfactory.js 25:0-52 @ ./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 ‘D:\Maki ngChoices.be\MobileApps\Apps\OHAMBO\src\app’ resolve ‘…/…/angularfire2/database’ in ‘D:\MakingChoices.be\MobileApps\Apps\OH AMBO\src\app’ using description file: D:\MakingChoices.be\MobileApps\Apps\OHAMBO\package.jso n (relative path: ./src/app) Field ‘browser’ doesn’t contain a valid alias configuration after using description file: D:\MakingChoices.be\MobileApps\Apps\OHAMBO\packa ge.json (relative path: ./src/app) using description file: D:\MakingChoices.be\MobileApps\Apps\OHAMBO\package.j son (relative path: ./angularfire2/database) no extension Field ‘browser’ doesn’t contain a valid alias configuration D:\MakingChoices.be\MobileApps\Apps\OHAMBO\angularfire2\database doesn’t exist .js Field ‘browser’ doesn’t contain a valid alias configuration D:\MakingChoices.be\MobileApps\Apps\OHAMBO\angularfire2\database.js does n’t exist .ts Field ‘browser’ doesn’t contain a valid alias configuration D:\MakingChoices.be\MobileApps\Apps\OHAMBO\angularfire2\database.ts does n’t exist as directory D:\MakingChoices.be\MobileApps\Apps\OHAMBO\angularfire2\database doesn’t exist [D:\MakingChoices.be\MobileApps\Apps\OHAMBO\angularfire2\database] [D:\MakingChoices.be\MobileApps\Apps\OHAMBO\angularfire2\database.js] [D:\MakingChoices.be\MobileApps\Apps\OHAMBO\angularfire2\database.ts] [D:\MakingChoices.be\MobileApps\Apps\OHAMBO\angularfire2\database] @ ./src/app/app.module.ngfactory.js 31:0-56 @ ./src/app/main.ts ** Errors in the JavaScript console **

** Output from firebase.database().enableLogging(true); **

** Screenshots **

Expected behavior

A good production build.

Actual behavior

Production build fails

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 5
  • Comments: 59 (6 by maintainers)

Most upvoted comments

AngularFire 4.0.0-rc.1 does not seem to have this issue, 4.0.0-rc.2 does. I rolled back for now.

This was a bug in version differences between the Angular CLI and Ionic CLI. Should be fixed in a day or so.

@davideast Can you link the issue relating to this in the ionic CLI please?

it is fixed now in “angularfire2”: “^5.0.0-rc.3”,… just run “npm install angularfire2 firebase promise-polyfill --save” and then run - "ionic cordova build android --prod "

@Abrahamh08 same issue in my ionic3 app with 5.0.0-rc.2. did you get any solution ??

I’m having the same problem with 5.0.0-rc.2

Is this updated yet?

@sloznjak yes bro ,

“dependencies”: { “@angular/common”: “4.4.3”, “@angular/compiler”: “4.4.3”, “@angular/compiler-cli”: “4.4.3”, “@angular/core”: “4.4.3”, “@angular/forms”: “4.4.3”, “@angular/http”: “4.4.3”, “@angular/platform-browser”: “4.4.3”, “@angular/platform-browser-dynamic”: “4.4.3”, “@angular/platform-server”: “2.2.1”, “@angular/tsc-wrapped”: “^4.4.5”, “@firebase/webchannel-wrapper”: “0.2.2”, “@ionic/storage”: “2.0.1”, “ionic-angular”: “3.7.1”, “@types/firebase”: “^2.4.32”, “angular-animate”: “^1.6.1”, “angular2-moment”: “^1.3.3”, “angularfire2”: “^5.0.0-rc.3”, “firebase”: “^4.6.0” ] and here is my ionic-info ---->

cli packages:

   @ionic/cli-utils  : 1.15.2
   ionic (Ionic CLI) : 3.15.2

global packages:

cordova (Cordova CLI) : 7.0.1

local packages:

@ionic/app-scripts : 3.0.0
Cordova Platforms  : none
Ionic Framework    : ionic-angular 3.7.1

System:

Android SDK Tools : 25.2.5
Node              : v6.10.1
npm               : 3.10.10
OS                : Windows 10

hope it will help you .

same issue with 5.0.0-rc.3 and app-scripts nightly.

@lordgreg , install angularfire2.rc1. It works with cordova build --prod

same issue for me