Firebase-js-sdk: firebase.analytics is not a function

Created on 30 Sep 2019  路  5Comments  路  Source: firebase/firebase-js-sdk

[REQUIRED] Describe your environment

  • Operating System version: Windows 10 1803
  • Browser version: chrome Version 77.0.3865.90 (Official Build) (64-bit)
  • Firebase SDK version: 7.0.0
  • Firebase Product: analytics

[REQUIRED] Describe the problem

Steps to reproduce:

trying to use firebase (google) analytics for webapps as described here

Relevant Code:

Tried to repro on stackblitz but it doesn't seem to work with firebase 7.0.0

import * as firebase from "firebase";
firebase.initializeApp({...});
const analytics = firebase.analytics();
analytics

Most helpful comment

Thanks for reporting it! I made a quick fix and linked the PR here.
As a workaround (also the best practice), please import Firebase SDKs individually:

import * as firebase from 'firebase/app';
import 'firebase/analytics';
import 'firebase/auth'
...

All 5 comments

I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.

oddly enough after updating to 7.0.0 the analytics folder appears to missing from the package:
image

Thanks for reporting it! I made a quick fix and linked the PR here.
As a workaround (also the best practice), please import Firebase SDKs individually:

import * as firebase from 'firebase/app';
import 'firebase/analytics';
import 'firebase/auth'
...

It has been fixed in [email protected]

thanks!

Was this page helpful?
0 / 5 - 0 ratings