'How to import firebase functions with npm?
Webpack is currently unable to build my project due to an error:
The target environment doesn't support dynamic import() syntax so it's not possible to use external type 'module' within a script
Imports that Webpack doesn't like most likely look like this:
import { initializeApp } from "https://www.gstatic.com/firebasejs/9.6.0/firebase-app.js";
import { getFirestore } from "https://www.gstatic.com/firebasejs/9.6.0/firebase-firestore.js";
import { getAuth } from "https://www.gstatic.com/firebasejs/9.6.0/firebase-auth.js";
import { getStorage } from "https://www.gstatic.com/firebasejs/9.6.0/firebase-storage.js";
import { onAuthStateChanged, createUserWithEmailAndPassword, signInWithEmailAndPassword, signOut } from "https://www.gstatic.com/firebasejs/9.6.0/firebase-auth.js";
How can I import this with npm or any other webpack-friendly way?
Solution 1:[1]
Is it not possible for you to just do npm i firebase and import those functions?
Also what framework are you using? There could be a firebase library tailored specifically for your framework, like Angular.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Tu Nguyen |
