it throws me this error: The target environment doesn't support dynamic import() syntax so it's not possible to use external type 'module' within a script, when trying to build an application in react for production. I use two files: App.js and firebase.js. These are the imports of the App.js, and the firebase.js file (which contains the firebase access configuration):
App.js:
import React from 'react';
import {auth, db} from './firebase'
import {
getFirestore,
collection,
getDocs,
onSnapshot,
addDoc,
deleteDoc,
doc,
getDoc,
updateDoc
}from 'https://www.gstatic.com/firebasejs/9.8.1/firebase-firestore.js';
import { getAuth, createUserWithEmailAndPassword, onAuthStateChanged,signInWithEmailAndPassword,signOut} from 'https://www.gstatic.com/firebasejs/9.8.1/firebase-auth.js';
firebase.js:
import { initializeApp } from "https://www.gstatic.com/firebasejs/9.8.1/firebase-app.js";
import {
getFirestore,
collection,
getDocs,
onSnapshot,
addDoc,
deleteDoc,
doc,
getDoc,
updateDoc,
} from "https://www.gstatic.com/firebasejs/9.8.1/firebase-firestore.js";
import { getAuth, createUserWithEmailAndPassword, onAuthStateChanged,signInWithEmailAndPassword,signOut} from 'https://www.gstatic.com/firebasejs/9.8.1/firebase-auth.js';
const firebaseConfig = {
//my data
};
// Initialize Firebase
const app = initializeApp(firebaseConfig);
const db = getFirestore(app);
const auth = getAuth(app);
export {auth,db}