項目一直運作良好,但突然出現了這個錯誤Uncaught SyntaxError: ambiguous indirect export: getFirestore,原因不明
<p>我的專案使用Firebase作為後端,這是設定檔:</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>嘗試使用as重新命名函數:</p>
<pre class="brush:php;toolbar:false;">import { getFirestore as getFirestoreFunction } from "firebase/firestore";</pre>
<blockquote>
<p>對於getFirestore起作用了</p>
</blockquote>
<blockquote>
<p>未捕獲的語法錯誤:不明確的間接導出:initializeApp</p>
</blockquote>
<blockquote>
<p>嘗試對initializeApp做同樣的操作</p>
</blockquote>
<pre class="brush:php;toolbar:false;">import { initializeApp as initFirebaseApp } from "firebase/app";</pre>
<blockquote>
<p>未捕獲的語法錯誤:不明確的間接導出:initializeApp</p>
</blockquote>
<p>這裡的版本是"firebase": "^8.6.8"</p>