I am trying to use Firebase Cloud Message (Google) to accept push message notifications. There are several steps to registering the user and setting up the serviceworker to handle the events, but I’m stuck on the first step as it suggests adding a <script>
tag with type="module"
. Here’s what I’m supposed to add:
// Import the functions you need from the SDKs you need
import { initializeApp } from "https://www.gstatic.com/firebasejs/10.6.0/firebase-app.js";
// TODO: Add SDKs for Firebase products that you want to use
// https://firebase.google.com/docs/web/setup#available-libraries
const app_key = "the key";
// Your web app's Firebase configuration
const firebaseConfig = {
apiKey: "3",
alotmore keys: "x"
};
// Initialize Firebase
firebase.initializeApp(firebaseConfig);
const m = firebase.messaging();
If I place this code in the function main()
, I get import disallowed, must be in a module error in chrome on the import statement.
What’s the best approach for including firebase into an appstudio app?