-
-
Notifications
You must be signed in to change notification settings - Fork 345
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
considered web-extension polyfill? #18
Comments
Unfortunately, Firefox compatibility is not considered. |
Although it's a bit cumbersome, it looks like you'll have to add the polyfill yourself. |
Coming across the issue, it looks like web-extension polyfill is not needed anymore for manifest v3. static convertManifestToString(manifest: Manifest): string {
if (process.env.__FIREFOX__) {
manifest = this.convertToFirefoxCompatibleManifest(manifest);
}
return JSON.stringify(manifest, null, 2);
}
static convertToFirefoxCompatibleManifest(manifest: Manifest) {
const manifestCopy = {
...manifest,
} as { [key: string]: unknown };
manifestCopy.background = {
scripts: [manifest.background?.service_worker],
type: "module",
};
manifestCopy.options_ui = {
page: manifest.options_page,
browser_style: false,
};
manifestCopy.content_security_policy = {
extension_pages: "script-src 'self'; object-src 'self'",
};
delete manifestCopy.options_page;
return manifestCopy as Manifest;
} and export default function customDynamicImport(): PluginOption {
return {
name: "custom-dynamic-import",
renderDynamicImport() {
if (process.env.__FIREFOX__) {
return {
left: `
{
const dynamicImport = (path) => import(path);
dynamicImport(browser.runtime.getURL('./') +
`,
// eslint-disable-next-line prettier/prettier
right: ".split('../').join(''))}",
};
} ... let me know if we want this as PR. |
I'm not a big fan of firefox, but I think this will help a lot of other people who are looking forward to firefox support. If you could post a PR, I would be so grateful! |
just wondering if you ever considered making this generally compatible with web extension to be used in firefox as well. Seems like most people use https://github.com/mozilla/webextension-polyfill
The text was updated successfully, but these errors were encountered: