Manifest.json multiple background services

17 Views Asked by At

I used the below in a Manifest v3 to create a Chrome extension.

"background": { 
  "service_worker": "js/background.js", 
  "type":"module" 
},

Can I put multiple background.js files in a manifest?

I did not found any information about this. Thanks for help!

1

There are 1 best solutions below

0
samayo On

You can not specify multiple background service workds directly in the background fied of the manifest.

To use multiple scripts you, should import them nto your main background service work

for example, if you have additional scripts use as

// in background.js
import './script1.js';
import './script2.js';