I am trying to add Firebase to a Chrome extension and am getting the error "Uncaught ReferenceError: firebase is not defined", when I follow examples I am finding on the Internet (including all the answers I find on Stack Overflow).
My background.js file is only a few lines:
var config = {
apiKey: "x-x",
authDomain: "xx",
databaseURL: "xx",
projectId: "xx",
storageBucket: "xx",
messagingSenderId: "xx"
};
firebase.initializeApp(config);
The manifest is equally simple:
{
"name": "test",
"version": "0.0.32",
"description": "test",
"background": {
"persistent": true,
"scripts": [
"background.js",
"firebase-app.js",
"firebase-firestore.js"
]
},
"short_name": "test",
"permissions": [
"activeTab"
],
"content_security_policy": "script-src 'self' https://cdn.firebase.com https://*.firebaseio.com; object-src 'self'",
"manifest_version": 2
}
If I try to use firebase.js (taken from Angular 7 node_modules directory) instead of firebase-app.js & firebase-firestore.js (from firebase-bower-master), Chrome complains and says I should include only the packages for the specific functions I want to use.
Every example I find indicates that the js scripts should be automatically loaded into background.js and work fine.
What am I missing?
Thanks for your help!
Edward
background.jsis last. - Chris G