In Chrome, I can load my standard create-react-app javascript files and the chrome variable is still set. However, in Firefox it seems to be undefined in the scripts that are loaded:
I have a content-script that just loads other content scripts dynamically:
function addToHead(s, toload) {
s.src = chrome.extension.getURL(toload);
s.href = chrome.extension.getURL(toload);
(document.head || document.documentElement).appendChild(s);
}
// React app..
var toload = ["chunk.js", "runtime.js", "main.js"];
toload.forEach(function (toload) {
console.log("Loading js: " + toload);
var s = document.createElement('script');
addToHead(s, toload);
})