1

I am trying to migrate/update a manifest 2 file to manifest 3. But I am getting the following error Invalid value for 'background.service_worker'. Could not load manifest.

From the original maifest 2 file I removed "persistent": true and changed "background": {"scripts": ["background.js", "worker.js"], to be "background": {"service_worker":["background.js", "worker.js"],

My full code for v3 can be seen below:

{
 "manifest_version": 3,

"name": "Chrome ext",
"description": "This is an extension ",
 "version": "1.1.1",
 "icons": {
"128":"icon.png"
  },

 "browser_action": {
 "default_icon": "icon.png",
 "default_popup": "popup.html",
"default_title": "Open ext"
 },
 "options_page": "options.html",
 "background": {
"service_worker": ["background.js", "worker.js"]

},
"permissions": [
  "tabCapture",
  "downloads",
 "storage"
 ],
 "commands": {
  "start": {
  "suggested_key": {
    "default": "Ctrl+Shift+S",
    "mac": "Command+Shift+U"
  },
  "description": "Start"
},
"stop": {
  "suggested_key": {
    "default": "Ctrl+Shift+X",
    "mac": "MacCtrl+Shift+X"
  },
  "description": "Stop"
}

} }

Bemz
  • 129
  • 1
  • 16
  • Does this answer your question? [chrome extension mv3 - Modularize service worker js file](https://stackoverflow.com/questions/66406672/chrome-extension-mv3-modularize-service-worker-js-file) – wOxxOm Oct 05 '22 at 20:20
  • It must be a string not an array. You will load the additional scripts inside, [example](https://stackoverflow.com/a/66408379). – wOxxOm Oct 05 '22 at 20:20

1 Answers1

1

You might need to follow below syntax

"background": {
     "service_worker": "background.js"
 }

and import both the scripts in single file

Madhav
  • 11
  • 1