I'm using firebase admin to interact with Firestore
and auth
from a custom backend (next.js api routes).
Firebase recently announced they're going with modular tree-shaking packages.
How can I refactor below code to utilize tree-shaking firebase module?
import * as firebaseAdmin from "firebase-admin";
if (!firebaseAdmin.apps.length) {
const adminCredentials = {
credential: firebaseAdmin.credential.cert({
projectId: env.fbProjIdPublic,
clientEmail: env.fbClientEmail,
privateKey: JSON.parse(env.fbPvtKey),
}),
databaseURL: env.fbDbUrlPublic,
};
firebaseAdmin.initializeApp(adminCredentials);
}
export default firebaseAdmin;
So far I couldn't find replacement for firebaseAdmin.credential.cert
.