diff --git a/packages/core/integration-tests/test/integration/webextension-mv3/manifest.json b/packages/core/integration-tests/test/integration/webextension-mv3/manifest.json index b8ff5f08993..08398794f2c 100644 --- a/packages/core/integration-tests/test/integration/webextension-mv3/manifest.json +++ b/packages/core/integration-tests/test/integration/webextension-mv3/manifest.json @@ -4,7 +4,9 @@ "version": "0.1", "manifest_version": 3, "background": { - "service_worker": "background.js" + "service_worker": "background.js", + "type": "module", + "scripts": [ "background.js" ] }, "permissions": [ "scripting", diff --git a/packages/core/integration-tests/test/webextension.js b/packages/core/integration-tests/test/webextension.js index f31629fffb7..2e2a681fbfc 100644 --- a/packages/core/integration-tests/test/webextension.js +++ b/packages/core/integration-tests/test/webextension.js @@ -111,6 +111,7 @@ describe('webextension', function () { assets: ['manifest.json'], }, {assets: ['background.js']}, + {assets: ['background.js']}, {assets: ['popup.html']}, {assets: ['popup.css']}, {assets: ['popup.js', 'esmodule-helpers.js', 'bundle-url.js']}, diff --git a/packages/transformers/webextension/src/WebExtensionTransformer.js b/packages/transformers/webextension/src/WebExtensionTransformer.js index 51cbe6a0ef7..3ee647fe8a9 100644 --- a/packages/transformers/webextension/src/WebExtensionTransformer.js +++ b/packages/transformers/webextension/src/WebExtensionTransformer.js @@ -273,7 +273,8 @@ async function collectDependencies( ...getJSONSourceLocation(ptrs['/background/page'], 'value'), }, }); - } else if (program.background?.service_worker) { + } + if (program.background?.service_worker) { program.background.service_worker = asset.addURLDependency( program.background.service_worker, { diff --git a/packages/transformers/webextension/src/schema.js b/packages/transformers/webextension/src/schema.js index 20f6dc6ca08..3f38853ef8b 100644 --- a/packages/transformers/webextension/src/schema.js +++ b/packages/transformers/webextension/src/schema.js @@ -473,6 +473,10 @@ export const MV3Schema = ({ type: 'string', enum: ['classic', 'module'], }, + // to support both Chrome and Firefox + scripts: arrStr, + page: string, + persistent: boolean, }, additionalProperties: false, required: ['service_worker'],