firebase / firebase/firebaseui-web-react
StyledFirebaseAuth not working with nextjs
- Vorherrschende Sprache
- JavaScript
- Sterne
- 1.3k
- Forks
- 246
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
I'm trying to get StyledFirebaseAuth to work with NextJS but I keep running into the following issues:
in the terminal when running `next dev`
```
wait - compiling /_error (client and server)...
error - ./node_modules/firebaseui/dist/firebaseui.css
Global CSS cannot be imported from within node_modules.
Read more: https://nextjs.org/docs/messages/css-npm
Location: node_modules/react-firebaseui/FirebaseAuth.js
```
and in the browser
```
Module not found: Package path ./compat is not exported from package /Users/paymahn/code/lookieloo/node_modules/firebase (see exports field in /Users/paymahn/code/lookieloo/node_modules/firebase/package.json)
2 | import {StyledFirebaseAuth} from "react-firebaseui";
3 | import {auth} from "../lib/firebase";
> 4 | import firebase from "firebase/compat";
5 | import 'firebase/compat/auth';
```
Here's the entire tsx file I'm using to make a login page:
```
import React from 'react';
import {StyledFirebaseAuth} from "react-firebaseui";
import {auth} from "../lib/firebase";
import firebase from "firebase/compat";
import 'firebase/compat/auth';
const uiConfig = {
signInFlow: 'popup',
signInSuccessUrl: '/',
signInOptions: [
firebase.auth.EmailAuthProvider.PROVIDER_ID,
],
};
const Login = () => {
return (
)
}
export default Login
```
I've also tried using `FirebaseAuth` instead of `StyledFirebaseAuth` but that results in the same issue.
Beitragsleitfaden
Rechercherichtung
Beginne mit node_modules/react-firebaseui/FirebaseAuth.js und der gezeigten Login-TSX-Datei und reproduziere dann beide Fehler mit next dev. Als erledigt gilt die Aufgabe, wenn die Next.js-App ohne die CSS- und Paketexportfehler kompiliert und die Login-Seite gerendert wird.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- firebase, nextjs, react, typescript
- Bereich
- authentication, frontend, web-dev
- Issue-Typ
- Bug
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Muss geklärt werden
- Anfängerfreundlichkeit
- 30/100