Skip to content

ionic build --prod fails for firebase(even with blank app) #3324

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
ketanyekale opened this issue Jun 27, 2018 · 2 comments
Open

ionic build --prod fails for firebase(even with blank app) #3324

ketanyekale opened this issue Jun 27, 2018 · 2 comments
Labels

Comments

@ketanyekale
Copy link

Description:
After adding firebase(not angularfire2) ionic build --prod hangs after copy finished step
The same work perfectly without --prod option. I'm using firebase auth, database and messaging in by PWA + Mobile Apps. All the features works perfectly in non-prod mode.

I even tried setting --max-old-space-size to 4GB but it still doesn't work.

Steps to Reproduce:
I have tried the same for blank ionic app.

  1. Create new blank ionic app

ionic start blank1 blank

  1. Need to add platform as ionic build needs atleast one platform

ionic cordova add platform android

  1. build without --prod will be successful
    ionic build

  2. build with --prod will also be successful
    ionic build --prod

  3. Now add firebase
    npm i -s firebase

  4. add firebase imports
    As mentioned at https://www.npmjs.com/package/firebase#include-only-the-features-you-need
    I have used the below code to import firebase app, auth database and messaging:

// This import loads the firebase namespace along with all its type information.
import firebase from 'firebase/app';

// These imports load individual services into the firebase namespace.
import 'firebase/auth';
import 'firebase/database';
import 'firebase/messaging';

I've added these imports in home.ts as:

import { Component } from '@angular/core';
import { NavController } from 'ionic-angular';
// This import loads the firebase namespace along with all its type information.
import firebase from 'firebase/app';

// These imports load individual services into the firebase namespace.
import 'firebase/auth';
import 'firebase/database';
import 'firebase/messaging';
@Component({
  selector: 'page-home',
  templateUrl: 'home.html'
})
export class HomePage {
  ts: any ='';
  constructor(public navCtrl: NavController) {
    this.ts = firebase.database.ServerValue.TIMESTAMP;// To avoid unnecessary warning: unused import firebase
  }
}
  1. build without --prod will be successful
    ionic build

  2. build with --prod will now fail
    ionic build --prod

Output:

c:\xampp\htdocs\blank1>ionic build --prod
Running app-scripts build: --prod
[20:11:41]  build prod started ...
[20:11:41]  clean started ...
[20:11:41]  clean finished in less than 1 ms
[20:11:41]  copy started ...
[20:11:41]  deeplinks started ...
[20:11:42]  deeplinks finished in 32 ms
[20:11:42]  ngc started ...
[20:11:50]  ngc finished in 8.87 s
[20:11:50]  preprocess started ...
[20:11:50]  preprocess finished in less than 1 ms
[20:11:50]  webpack started ...
[20:11:51]  copy finished in 9.42 s

My ionic info:

c:\xampp\htdocs\blank1>ionic info

cli packages: (C:\Users\Desk06\AppData\Roaming\npm\node_modules)

    @ionic/cli-utils  : 1.19.2
    ionic (Ionic CLI) : 3.20.0

global packages:

    cordova (Cordova CLI) : 8.0.0

local packages:

    @ionic/app-scripts : 3.1.10
    Cordova Platforms  : android 7.0.0
    Ionic Framework    : ionic-angular 3.9.2

System:

    Android SDK Tools : 26.1.1
    Node              : v8.11.1
    npm               : 6.0.1
    OS                : Windows 10

Environment Variables:

    ANDROID_HOME : E:\android_sdks

Misc:

    backend : pro

Other Information:

c:\xampp\htdocs\blank1>ionic build
Running app-scripts build:
[20:03:52]  build dev started ...
[20:03:52]  clean started ...
[20:03:52]  clean finished in 16 ms
[20:03:52]  copy started ...
[20:03:53]  deeplinks started ...
[20:03:53]  deeplinks finished in 15 ms
[20:03:53]  transpile started ...
[20:03:57]  transpile finished in 4.26 s
[20:03:57]  preprocess started ...
[20:03:57]  preprocess finished in 1 ms
[20:03:57]  webpack started ...
[20:03:57]  copy finished in 4.48 s
[20:04:04]  webpack finished in 6.71 s
[20:04:04]  sass started ...
Without `from` option PostCSS could generate wrong source map and will not find Browserslist config. Set it to CSS file path or to `undefined` to prevent this warning.
[20:04:05]  sass finished in 1.48 s
[20:04:05]  postprocess started ...
[20:04:05]  postprocess finished in 15 ms
[20:04:05]  lint started ...
[20:04:05]  build dev finished in 12.71 s
> ionic cordova prepare --no-build
> cordova prepare
Android Studio project detected


[20:04:11]  lint finished in 6.09 s

c:\xampp\htdocs\blank1>ionic build --prod
Running app-scripts build: --prod
[20:04:28]  build prod started ...
[20:04:28]  clean started ...
[20:04:28]  clean finished in less than 1 ms
[20:04:28]  copy started ...
[20:04:28]  deeplinks started ...
[20:04:28]  deeplinks finished in 16 ms
[20:04:28]  ngc started ...
[20:04:37]  ngc finished in 8.62 s
[20:04:37]  preprocess started ...
[20:04:37]  preprocess finished in less than 1 ms
[20:04:37]  webpack started ...
[20:04:37]  copy finished in 9.10 s
[20:05:06]  webpack finished in 28.59 s
[20:05:06]  uglify started ...
[20:05:06]  sass started ...
Without `from` option PostCSS could generate wrong source map and will not find Browserslist config. Set it to CSS file path or to `undefined` to prevent this warning.
[20:05:07]  sass finished in 1.73 s
[20:05:07]  cleancss started ...
[20:05:10]  cleancss finished in 2.50 s
[20:05:21]  uglify finished in 15.87 s
[20:05:21]  postprocess started ...
[20:05:21]  postprocess finished in less than 1 ms
[20:05:21]  lint started ...
[20:05:21]  build prod finished in 53.26 s
> ionic cordova prepare --no-build
> cordova prepare
Android Studio project detected


[20:05:28]  lint finished in 6.48 s

c:\xampp\htdocs\blank1>npm i -s firebase
[grpc] Success: "c:\xampp\htdocs\blank1\node_modules\grpc\src\node\extension_binary\node-v57-win32-x64-unknown\grpc_node.node" is installed via remote
+ [email protected]
added 110 packages from 59 contributors in 42.995s
[!] 1 vulnerability found [3788 packages audited]
    Severity: 1 Low
    Run `npm audit` for more detail


c:\xampp\htdocs\blank1>ionic build
Running app-scripts build:
[20:10:52]  build dev started ...
[20:10:52]  clean started ...
[20:10:52]  clean finished in 16 ms
[20:10:52]  copy started ...
[20:10:53]  deeplinks started ...
[20:10:53]  deeplinks finished in 31 ms
[20:10:53]  transpile started ...
[20:10:57]  transpile finished in 4.59 s
[20:10:57]  preprocess started ...
[20:10:57]  preprocess finished in less than 1 ms
[20:10:57]  webpack started ...
[20:10:57]  copy finished in 4.86 s
[20:11:04]  webpack finished in 7.35 s
[20:11:04]  sass started ...
Without `from` option PostCSS could generate wrong source map and will not find Browserslist config. Set it to CSS file path or to `undefined` to prevent this warning.
[20:11:06]  sass finished in 1.81 s
[20:11:06]  postprocess started ...
[20:11:06]  postprocess finished in 47 ms
[20:11:06]  lint started ...
[20:11:06]  build dev finished in 14.10 s
> ionic cordova prepare --no-build
> cordova prepare
[20:11:13]  lint finished in 6.97 s
Android Studio project detected



c:\xampp\htdocs\blank1>ionic build --prod
Running app-scripts build: --prod
[20:11:41]  build prod started ...
[20:11:41]  clean started ...
[20:11:41]  clean finished in less than 1 ms
[20:11:41]  copy started ...
[20:11:41]  deeplinks started ...
[20:11:42]  deeplinks finished in 32 ms
[20:11:42]  ngc started ...
[20:11:50]  ngc finished in 8.87 s
[20:11:50]  preprocess started ...
[20:11:50]  preprocess finished in less than 1 ms
[20:11:50]  webpack started ...
[20:11:51]  copy finished in 9.42 s

@ionitron-bot ionitron-bot bot added the triage label Jun 27, 2018
@ljieyao
Copy link

ljieyao commented Jul 11, 2018

I have the same issue. plz help.

@parceeatg
Copy link

Same Issue also. Please fix this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants