Google plugin (Chrome extension) "Service Worker (invalid)" solution

Problem description:background An error was reported when writing the file, saying that Service Workerthe set is backgroundinvalid.
insert image description here

Workaround (check) method:

  1. Check if 配置文件(manifest.json)in is . The parameter setting in is only used in the version, and it is used in the v2 version .manifest_version3
    backgroundservice_worker后台页(background.js)v3"scripts": ["background.js"]
    insert image description here
  2. background.jsThe file must be in the root directory. I have set the directory "service_worker": "js/background.js"to cause an error, and the official website also has instructions.
    insert image description here

Error:
insert image description here
Correct:
insert image description here

  1. background.jsThe problem of plug-in calling in the file will also report this error. Generally, this kind of error can 扩展程序页面be viewed directly in the error.
    insert image description here

Basically, after checking the above three places, this problem can be solved.

Guess you like

Origin blog.csdn.net/qq_17627195/article/details/131884525