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

Fix SW packaging in web extensions #8424

Merged
merged 2 commits into from Oct 24, 2022
Merged
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
7 changes: 7 additions & 0 deletions packages/packagers/webextension/src/WebExtensionPackager.js
Expand Up @@ -23,6 +23,13 @@ export default (new Packager({
relativeBundlePath(bundle, b, {leadingDotSlash: false});

const manifest = JSON.parse(await asset.getCode());

if (manifest.background?.type === 'module') {
// service workers are built with output format 'global'
// see: https://github.com/parcel-bundler/parcel/blob/3329469f50de9326c5b02ef0ab1c0ce41393279c/packages/transformers/js/src/JSTransformer.js#L577
delete manifest.background.type;
}

const deps = asset.getDependencies();
const war = [];
for (const contentScript of manifest.content_scripts || []) {
Expand Down