Service worker registration failed : mv2 to mv3

1,675 views
Skip to first unread message

Sangeetha Panneerselvam

unread,
Jul 23, 2021, 8:54:13 AM7/23/21
to Chromium Extensions
I need help with manifest migration from version 2 to 3. 

I have changed the manifest.json, also tried the so many suggested solutions seen in many platform like wrapping up in js file with try/catch using importScripts(),etc. 

But nothing worked out.
Please help me to fix this

manifest.json:
  "background":{
    "service_worker":"background-wrapper.js",
    "type":"module"
  },

backgroud-wrapper.js:
import './background.js';
// importScripts("background.js");

// try {
//     importScripts("background.js");
// } catch (e) {
//     console.error(e);
// }

background.js
actual background script
have many functionality for the extension

Simeon Vincent

unread,
Jul 23, 2021, 2:17:08 PM7/23/21
to Chromium Extensions, sangee...@gmail.com
Here's a demo of a Manifest V3 extension with a service worker using importScripts and try/catch: https://gist.github.com/dotproto/83f8354b452472576272966ea4b09c6e

Here's a demo of a Manifest V3 extensions with a module service worker: https://gist.github.com/dotproto/418ba29bbeafb5b2a0e1665f4cd3de2a

Simeon - @dotproto
Chrome Extensions DevRel

Reply all
Reply to author
Forward
0 new messages