I get the following error when I try to compile my extension with the command: npm run chrome
"background" [1]: {
"service_worker": "background/index.js"
}
}
[1] "value" must contain at least one of [scripts, page]
at Object.validate (/home/mahmoud/Desktop/extension2.0/browser_extension/node_modules/webpack-webextension-plugin/manifest-utils/validate.js:143:11)
at async WebextensionPlugin.addManifest (/home/mahmoud/Desktop/extension2.0/browser_extension/node_modules/webpack-webextension-plugin/index.js:202:5)
at async Promise.all (index 1)
/home/mahmoud/Desktop/extension2.0/browser_extension/node_modules/webextension-toolbox/bin/webextension-toolbox:57
console.log(stats.toString({
^
TypeError: Cannot read properties of null (reading 'toString')
at Watching.logCompileOutput [as handler] (/home/mahmoud/Desktop/extension2.0/browser_extension/node_modules/webextension-toolbox/bin/webextension-toolbox:57:21)
at Watching._done (/home/mahmoud/Desktop/extension2.0/browser_extension/node_modules/webextension-toolbox/node_modules/webpack/lib/Watching.js:95:9)
at /home/mahmoud/Desktop/extension2.0/browser_extension/node_modules/webextension-toolbox/node_modules/webpack/lib/Watching.js:52:27
at /home/mahmoud/Desktop/extension2.0/browser_extension/node_modules/webextension-toolbox/node_modules/webpack/lib/Compiler.js:492:20
at eval (eval at create (/home/mahmoud/Desktop/extension2.0/browser_extension/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:22:1)`
This is the manifest file:
{
"__firefox__manifest_version": 2,
"__chrome__manifest_version": 3,
"__chrome__name": "extension_name",
"__firefox__name": "extension_name",
"version": "4.4.1",
"__chrome__description": "in Chrome",
"__firefox__description": "in Firefox",
"icons":{
"48": "common/icons/logored.png"
},
"__firefox__browser_action":{
"default_icon":{
"48": "common/icons/logowhite.png"
},
"default_title":"extension",
"default_popup": "menu/index.html"
},
"__chrome__action":{
"default_icon":{
"48": "common/icons/logowhite.png"
},
"default_title":"extension",
"default_popup": "menu/index.html"
},
"__firefox__background":{
"scripts": ["background/index.js"]
},
"__chrome__background":{
"service_worker": "background/index.js"
},
"options_ui":{
"page":"options/index.html",
"open_in_tab": true
},
"__firefox__web_accessible_resources":[
"common/icons/**/*",
"**/index.html",
"**/index.js.map",
"common/public/*",
"common/public/**/*"
],
"__chrome__web_accessible_resources":[
{
"resources": [
"common/icons/**/*",
"**/index.html",
"**/index.js.map",
"common/public/*",
"common/public/**/*"
],
"matches":["<all_urls>"]
}
],
"homepage_url": "https://www.extension.com",
"__firefox__permissions":["storage","proxy","privacy","webNavigation","webRequest","tabs","<all_urls>","*://*/*","webRequestBlocking"],
"__chrome__permissions":["storage","proxy","privacy","webNavigation","webRequest","webRequestAuthProvider","declarativeNetRequest","tabs","scripting","offscreen","browsingData"],
"__firefox__browser_specific_settings":{
"gecko":{
"id":"{asdsdfs-dfsa-sdfs-asc-22asdasd23}",
"strict_min_version":"91.1.0"
}
},
}
I was migrating my manifest file to support chrome manifest v3 while keeping firefox at v2.
I did the changes to the manifest file and was expecting the initial run of:
npm run chrome
command to produce the chrome extension dist folder.
Instead I got the above error.
I’m sort of new to the code base I’m working on, so I’d appreciate any help I can get.
I’m suspecting that the problem is with webpack because I’m almost sure my manifest file is ok.