Skip to content

XHR Compat Lib not loaded doing firebase/app require #522

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

Closed
jshcrowthe opened this issue Feb 20, 2018 · 5 comments
Closed

XHR Compat Lib not loaded doing firebase/app require #522

jshcrowthe opened this issue Feb 20, 2018 · 5 comments

Comments

@jshcrowthe
Copy link
Contributor

If a user trying to use the SDK leverages the firebase/app entrypoint (instead of firebase), the XHR compatibility library isn't loaded.

This results in the following code not working in node:

var firebase = require('firebase/app');
require('firebase/auth');
require('firebase/database');

var app = firebase.initializeApp({ ... });

From #349 (comment)

@google-oss-bot
Copy link
Contributor

Hmmm this issue does not seem to follow the issue template. Make sure you provide all the required information.

@google-oss-bot
Copy link
Contributor

Hey there! I couldn't figure out what this issue is about, so I've labeled it for a human to triage. Hang tight.

@nessup
Copy link

nessup commented Jun 8, 2018

I have this issue as well, and currently no way to get around it.

@nessup
Copy link

nessup commented Jun 14, 2018

Figured it out. If you're using Webpack, you need to ensure that the correct Firebase bundle is loaded when requiring any of the Firebase subpackages. Webpack likes to load module rather than main if both are specified in a package.json (which is the case for all Firebase components). You can correct this by adding the following top-level config to your Webpack config:

  resolve: {
    mainFields: ['main']
  },

There should probably be some documentation or a fix on Firebase's side since this is a really easy error to run in to.

@jshcrowthe
Copy link
Contributor Author

@nessup, just looking at this again, this has been resolved in the latest firebase versions. Are you still seeing this issue, and if so, can you open another issue with a repro?

@firebase firebase locked and limited conversation to collaborators Oct 22, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants