Closed alescdb closed 1 year ago
It is important to note that the Firefox Extension utilizes Manifest V2, which Chrome no longer supports. This means that V2-specific codes such as chrome.webRequest.onBeforeSendHeaders.addListener
cannot be executed on Chrome. This code only runs on Firefox, albeit the confusing name.
Firefox detection at runtime seems "useless" and can be done while transpiling ts
(this will remote firefox specific code for chrome), e.g. :
Define a environment variable in webpack (chrome & fiorefox):
new webpack.DefinePlugin({
firefox: JSON.stringify(false),
}),
And in background.ts :
declare var firefox : boolean | undefined;
if (firefox) {
console.log("Firefox !");
} else {
console.log("Chrome !");
}
The transpiled js for firefox extension wil only contains :
console.log("Firefox !");
same for chrome :
console.log("Chrome !");
That optimization idea is fantastic!
Would it be possible for you to handle the Webpack implementation? I'm not very experienced with defining custom configurations.
Done (sorry for the delay) :-)
It should work with all browsers (including mobile) and solved #109