Skip to content

Commit

Permalink
Fix SW packaging in web extensions (#8424)
Browse files Browse the repository at this point in the history
  • Loading branch information
olistic committed Oct 24, 2022
1 parent 041d633 commit 59610c1
Showing 1 changed file with 7 additions and 0 deletions.
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

0 comments on commit 59610c1

Please sign in to comment.