Targeting Different Browsers for background scripts #1812
Replies: 1 comment
-
Doing this for now 'entrypoints:found': (wxt, entrypoints) => {
const browser = wxt.config.browser;
for (let i = 0; i < entrypoints.length; i++) {
const entrypoint = entrypoints[i]!;
const path = entrypoint.inputPath;
const backgroundMatch = (path.includes('background-firefox') && browser === 'firefox') ||
(path.includes('background-chrome') && browser === 'chrome');
if (backgroundMatch) {
// Overrid the type to background so it can generate the manifest correctly
entrypoint.type = 'background';
}
}
}, |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi, my extension will both have chrome version and firefox version where chrome version is just a small set of the firefox version, so I don't want to include everything inside background script in the chrome version. I have tried this:
but the bundled code for chrome still have everything, I known i can use the code below inside the
manifest
option withinwxt.config.ts
with two background scriptbackground-firefox
andbackground-chrome
:but just wondering is there an easy way to do this.
Thanks in advance.
Beta Was this translation helpful? Give feedback.
All reactions