Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow both service_worker and scripts in MV3 Web Extensions #9673

Merged
merged 4 commits into from May 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -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",
Expand Down
1 change: 1 addition & 0 deletions packages/core/integration-tests/test/webextension.js
Expand Up @@ -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']},
Expand Down
Expand Up @@ -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,
{
Expand Down
4 changes: 4 additions & 0 deletions packages/transformers/webextension/src/schema.js
Expand Up @@ -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'],
Expand Down