Search code examples
google-chrome-extensionfirefox-addonmanifest

File structure for publishing firefox addon


I'm trying to publish a firefox addon, but I'm getting an error:

Error: "/background" is in an unsupported format

My first thought was that maybe it's an issue with me migrating from manifest v2 to v3, but since it says "/background" I figured maybe I'm supposed to have a background folder or something. If that's the case, are there any other changes I need to make for my file strucutre? If not, what's the issue here?

Here is my current file structure:

┣ 📂.vscode
 ┃ ┗ 📜settings.json
 ┣ 📂css
 ┃ ┣ 📜options.css
 ┃ ┗ 📜popup.css
 ┣ 📂html
 ┃ ┣ 📜options.html
 ┃ ┗ 📜popup.html
 ┣ 📂icons
 ┃ ┣ 📂128
 ┃ ┃ ┣ 📜error.png
 ┃ ┃ ┣ 📜operational.png
 ┃ ┃ ┗ 📜warning.png
 ┃ ┣ 📂feather
 ┃ ┃ ┣ 📜help-circle.svg
 ┃ ┃ ┣ 📜refresh-cw.svg
 ┃ ┃ ┗ 📜settings.svg
 ┃ ┣ 📜.DS_Store
 ┃ ┣ 📜green_icon.png
 ┃ ┣ 📜red_icon.png
 ┃ ┗ 📜yellow_icon.png
 ┣ 📂js
 ┃ ┣ 📂node_modules
 ┃ ┃ ┣ 📂@types
 ┃ ┃ ┃ ┗ 📂firefox-webext-browser
 ┃ ┃ ┃ ┃ ┣ 📜LICENSE
 ┃ ┃ ┃ ┃ ┣ 📜README.md
 ┃ ┃ ┃ ┃ ┣ 📜index.d.ts
 ┃ ┃ ┃ ┃ ┗ 📜package.json
 ┃ ┃ ┗ 📜.package-lock.json
 ┃ ┣ 📜common.js
 ┃ ┣ 📜options.js
 ┃ ┣ 📜package-lock.json
 ┃ ┣ 📜package.json
 ┃ ┣ 📜popup.js
 ┃ ┗ 📜test.js
 ┣ 📜.DS_Store
 ┣ 📜LICENSE
 ┣ 📜README.md
 ┣ 📜jsconfig.json
 ┗ 📜manifest.json

And here is my current manifest.json:

{
  "manifest_version": 3,
  "name": "GPTstatus",
  "version": "1.0",

  "browser_specific_settings": {
    "gecko": {
      "id": "[email protected]"
    }
  },

  "description": "A browser extension that changes its icon depending on the status of ChatGPT.",
  "homepage_url": "https://github.com/Zev18/gptstatus",
  "icons": {
    "128": "icons/128/operational.png"
  },

  "action": {
    "default_icon": "icons/128/operational.png",
    "default_title": "GPTstatus",
    "default_popup": "html/popup.html"
  },

  "background": {
    "service_worker": "js/common.js"
  },

  "options_ui": {
    "page": "html/options.html",
    "browser_style": true
  },

  "permissions": ["storage", "tabs"]
}

Thank you in advance!!


Solution

  • The answer is to use scripts instead of service_worker, as mentioned by wOxxOm in their comment. Just putting this here so I can mark the question as answered.