The project has been running well, but suddenly this error appeared, Uncaught SyntaxError: ambiguous indirect export: getFirestore, for unknown reasons
P粉790819727
2023-09-04 22:24:44
<p>My project uses Firebase as the backend, this is the configuration file: </p>
<pre class="brush:php;toolbar:false;">import { initializeApp } from "firebase/app";
import { getAuth } from "firebase/auth";
import { getFirestore } from "firebase/firestore";
import { getStorage } from "firebase/storage";
const firebaseConfig = {
stuff...
};
const app = initializeApp(firebaseConfig);
export const auth = getAuth(app);
export const db = getFirestore(app);
export const storage = getStorage(app);</pre>
<p>Try using as to rename the function: </p>
<pre class="brush:php;toolbar:false;">import { getFirestore as getFirestoreFunction } from "firebase/firestore";</pre>
<blockquote>
<p>It works for getFirestore</p>
</blockquote>
<blockquote>
<p>Uncaught syntax error: ambiguous indirect export: initializeApp</p>
</blockquote>
<blockquote>
<p>Try the same thing with initializeApp</p>
</blockquote>
<pre class="brush:php;toolbar:false;">import { initializeApp as initFirebaseApp } from "firebase/app";</pre>
<blockquote>
<p>Uncaught syntax error: ambiguous indirect export: initializeApp</p>
</blockquote>
<p>The version here is "firebase": "^8.6.8"</p>
Looks like you are running an outdated version of firebase. Installing the latest version should theoretically solve the problem you are facing. You can refer to the comments on this link: https://stackoverflow.com/a/70164464/19119712
If you make a change, please let me know if it works. Good luck!