Skip to content

"browserLocalPersistence" is not exported by "node_modules/firebase/auth/web-extension/dist/esm/index.esm.js" #8674

@vanghoa

Description

@vanghoa

Operating System

macOS Ventura 13.6.6

Environment (if applicable)

Node.js v22.9.0

Firebase SDK Version

latest - 11.0.2

Firebase SDK Product(s)

Auth

Project Tooling

Vite 5.0.3

Detailed Problem Description

As the title says, I'm developing a Chrome Extension that has firebase auth - I want to persist the login state - when build, it shows "error during build:
src/lib/firebase/index.ts (3:9): "browserLocalPersistence" is not exported by "node_modules/firebase/auth/web-extension/dist/esm/index.esm.js", imported by "src/lib/firebase/index.ts"."

Thank you all!

below is the src/lib/firebase/index.ts

`// Import the functions you need from the SDKs you need
import { getApps, initializeApp } from 'firebase/app';
import { browserLocalPersistence, getAuth, setPersistence } from 'firebase/auth/web-extension';
import { getFirestore } from 'firebase/firestore';

const firebaseConfig = {
// my firebase config
};

function makeApp() {
const apps = getApps();
if (apps.length > 0) {
return apps[0]!;
}
return initializeApp(firebaseConfig);
}

const app = makeApp();
export const db = getFirestore(app);
export const auth = getAuth(app);
setPersistence(auth, browserLocalPersistence);
`

Steps and code to reproduce issue

vite build

-> errors show up

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions