-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
ES6 module cannot import firebase #722
Comments
Try the following:
|
|
This repo is for |
The issue is with |
This was the recommendation that Firebase has given for module bundlers and as far as I can tell all ES6 consumption is via module bundlers. |
@bojeil-google They are referring to bundling CommonJS/UMD with "a bundler (like Browserify or webpack)". Webpack and browserify will not use the ES module build, they will use the CommonJS/UMD build. To use the ES module build you need a simple bundler like rollup that only resolves bare module specifiers (i.e. |
Ran into the same problem and solved it the same way as @maxwell8888 described it very correctly. |
Running into the same issue I think. Using rollup resolve with a firebaseui import and get the same message as reported. Per @maxwell8888's note, @bojeil-google's suggestion to use Also tried @maxwell8888 's solution but ended up with a new issue...
and had to make the following change:
|
I also experienced this issue and used "string-replace-loader" to replace the
I'm using the latest preact-cli and I'm not sure this is a universal fix for other setups but this worked for me. Open source project for reference. @bojeil-google this still seems like an active issue related to esm builds. |
Failed to compile. ./node_modules/firebaseui/dist/esm.js Been stuck on this and been a pain in the ass. No solution resolved this error. class App extends Component { REACT PHONE AUTHENTICATION</> ) } } export default App; |
@bojeil-google Your comment "This is the recommendation..." is out-of-date; noting DIRECTLY FROM THE DOCUMENTATION you cite (https://firebase.google.com/docs/web/setup#using-module-bundlers):
I note your package.json has the line:
Since current version is at least 8.1.1, why haven't you come up-to-date? I am also using CRA (and have no reason yet to eject), so hacking webpack configuration is not reasonable. Come up to date, and everybody will be happy and stop bugging you. |
v4.7.1 updates ES6 import: |
[REQUIRED] Describe your environment
[REQUIRED] Describe the problem
Steps to reproduce:
I am using
import * as firebaseui from 'firebaseui'
to import firebaseui as an ES module (built with rollup) fromnode_modules/firebaseui/dist/esm.js
. This module tries to import firebase usingimport * as firebase from 'firebase/app'
fromnode_modules/firebase/app/dist/index.esm.js
, however this does not work an errors withauth is not exported by node_modules/firebase/app/dist/index.esm.js
. Instead it should be importing firebase withimport firebase from 'firebase/app'
which works as expected.Relevant Code:
https://stackblitz.com/fork/firebase-issue-sandbox
The text was updated successfully, but these errors were encountered: