Comments (4)
Coming across the issue, it looks like web-extension polyfill is not needed anymore for manifest v3.
Firefox support though, achievable by small edition of manifest-parser (there is some small differences).
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.
from chrome-extension-boilerplate-react-vite.
Unfortunately, Firefox compatibility is not considered.
Because I personally don't use Firefox. 😞
from chrome-extension-boilerplate-react-vite.
Although it's a bit cumbersome, it looks like you'll have to add the polyfill yourself.
from chrome-extension-boilerplate-react-vite.
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!
from chrome-extension-boilerplate-react-vite.
Related Issues (20)
- Can't load content scripts in FireFox HOT 5
- Sending a message from the popup to content or content-ui HOT 2
- Constantly getting error in console `WebSocket connection to 'ws://localhost:8081/' failed:` HOT 24
- Storage doesn't work in background script HOT 4
- beginner's tutorial HOT 3
- Why is there a (redundant?) index.html file under pages/options/src/index.html? HOT 2
- How can I add some injected content scripts? HOT 3
- Build command isn't working after #492 HOT 4
- Add I18n package HOT 1
- Dev command isn't working after commit 5c3d905 HOT 5
- Background script throws error HOT 4
- .prettierignore is not applied into whole packages HOT 1
- Separate eslint and prettier into package HOT 1
- Injecting scripts from popup for latest version HOT 5
- Lint error occurs after the dev build in `useStorage.tsx` HOT 1
- Lint warning occurs due to a version issue
- Add script to remove all node_modules across the entire workspace HOT 2
- Add turbo generator template
- `outDir is not inside project root and will not be emptied` warning in vite HOT 1
- Use typescript in tailwind-config package and restruct HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from chrome-extension-boilerplate-react-vite.