Replies: 13 comments 2 replies
-
This should work 🤷♂ import * as firebase from "firebase/app";
import "firebase/auth";
import * as firebaseui from "firebaseui"; |
Beta Was this translation helpful? Give feedback.
-
@mischnic did you try it, does it work for you ? |
Beta Was this translation helpful? Give feedback.
-
According to the documentation, it should. I've looked at the published |
Beta Was this translation helpful? Give feedback.
-
Same issue here. Did you get it resolved? I was using the above import syntax exactly and it doesn’t work. |
Beta Was this translation helpful? Give feedback.
-
(Maybe related to #3387?) |
Beta Was this translation helpful? Give feedback.
-
@dawogfather, I haven't gotten it resolved yet :( |
Beta Was this translation helpful? Give feedback.
-
@mischnic , the linked issue does indeed look very similar. Fingers crossed that the PR fixes Do you know the correct procedure here? |
Beta Was this translation helpful? Give feedback.
-
Let's keep both open until the next release with that PR and then test both issues. |
Beta Was this translation helpful? Give feedback.
-
not stale |
Beta Was this translation helpful? Give feedback.
-
Is there a full example we can refer to? I found this one, but I'm not sure if it's the best because the config is directly in index.html, and they're not using the packages for firebase |
Beta Was this translation helpful? Give feedback.
-
@mischnic Thanks for the help, but I figured it out. Not sure if this is the best way, but I made file called import firebase from 'firebase/app';
import 'firebase/auth';
const firebaseConfig = {
// config here
};
export const app = firebase.initializeApp(firebaseConfig); Then whenever I need to use firebase, I can import in my script like this: import { app } from './firebase.js';
import firebase from 'firebase/app';
import 'firebase/firestore';
import 'firebase/auth';
...
const db = firebase.firestore(app); |
Beta Was this translation helpful? Give feedback.
-
I am also having problem with Parcel and firebase/firebaseui. CDN of course works, but when using npm modules I cannot import neither firebase or firebaseui successfully. |
Beta Was this translation helpful? Give feedback.
-
Ok after some research I have managed to have working imports in Parcel by importing manually CommonJS instead of ES6 modules: import firebase from "firebase/app/dist/index.cjs";
import "firebase/auth/dist/index.cjs";
import firebaseui from "firebaseui/dist/npm";
import "firebaseui/dist/firebaseui.css"; Anyone from Parcel Team could look into this why we need to do this? Is that connected with fact that firebase is exported using Google Closure Compiler? |
Beta Was this translation helpful? Give feedback.
-
❔ Question
How can I bundle Firebase and FirebaseUI, installed with npm, with Parcel ?
🔦 Context
My webapp uses FirebaseUI to let users log in. The installation instructions list a variety of options to install FirebaseUI: https://github.com/firebase/firebaseui-web#installation
The first option works fine for me. But CDN imports in the HTML are messy, I would like to use parcel to bundle the imports instead.
As soon as I add the import statements to my typescript code, FirebaseUI stops working and complains that
firebaseui.auth
is undefined. It works only, if there are only the CDN script tags in the HTML.💻 Code Sample
To run the following code, you have to enter a correct Firebase config in the typescript code and bundle index.html with parcel. Please note, you can't just open the compiled html in your browser. Firebase expects a hosted environment.
index.html:
index.ts:
package.json:
🌍 Your Environment
Beta Was this translation helpful? Give feedback.
All reactions