mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-07-02 12:22:22 +00:00
🔥 fix: Firebase CDN Initialization Under tsdown CJS Interop (#14046)
The `@librechat/api` build migrated to tsdown (rolldown/oxc) in #13595. tsdown externalizes third-party deps and uses strict CJS interop, so a default import of the Firebase v9+ modular SDK — whose CJS entry is `__esModule`-marked with only named exports and no `default` — resolves to `undefined`. `firebase.initializeApp(...)` then throws: TypeError: Cannot read properties of undefined (reading 'initializeApp') crashing startup whenever the Firebase file strategy is configured (`fileStrategy: firebase` or a granular `fileStrategies` entry). Switch to the idiomatic modular named import (`initializeApp`) and use the already-imported `FirebaseApp` type for the return annotation.
This commit is contained in:
parent
6576688f1b
commit
68bb533083
1 changed files with 3 additions and 3 deletions
|
|
@ -1,4 +1,4 @@
|
|||
import firebase from 'firebase/app';
|
||||
import { initializeApp } from 'firebase/app';
|
||||
import { getStorage } from 'firebase/storage';
|
||||
import { logger } from '@librechat/data-schemas';
|
||||
import type { FirebaseStorage } from 'firebase/storage';
|
||||
|
|
@ -7,7 +7,7 @@ import type { FirebaseApp } from 'firebase/app';
|
|||
let firebaseInitCount = 0;
|
||||
let firebaseApp: FirebaseApp | null = null;
|
||||
|
||||
export const initializeFirebase = (): firebase.FirebaseApp | null => {
|
||||
export const initializeFirebase = (): FirebaseApp | null => {
|
||||
if (firebaseApp) {
|
||||
return firebaseApp;
|
||||
}
|
||||
|
|
@ -31,7 +31,7 @@ export const initializeFirebase = (): firebase.FirebaseApp | null => {
|
|||
return null;
|
||||
}
|
||||
|
||||
firebaseApp = firebase.initializeApp(firebaseConfig);
|
||||
firebaseApp = initializeApp(firebaseConfig);
|
||||
logger.info('Firebase CDN initialized');
|
||||
return firebaseApp;
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue