From 35acf07c308ce8030aaf0ad1bbb10f565608f35e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=E2=9D=A4=EF=B8=8F=20=E2=98=AE=EF=B8=8F=20=E2=9C=8B?= <6723574+louisgv@users.noreply.github.com> Date: Wed, 28 Jun 2023 20:15:40 -0700 Subject: [PATCH] fix: firefox bgsw parsing bug --- .../parcel-transformer-manifest/src/handle-background.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/parcel-transformer-manifest/src/handle-background.ts b/packages/parcel-transformer-manifest/src/handle-background.ts index 945f6cc73..047e04275 100644 --- a/packages/parcel-transformer-manifest/src/handle-background.ts +++ b/packages/parcel-transformer-manifest/src/handle-background.ts @@ -41,8 +41,10 @@ function handleMV3Background(program: MV3Data) { function handleFirefoxMV3Background(program: MV3Data) { const mv2Program = program as unknown as MV2Data - mv2Program.background.scripts = [program.background.service_worker] - delete program.background.service_worker + if (program.background?.service_worker) { + mv2Program.background.scripts = [program.background.service_worker] + delete program.background.service_worker + } handleMV2BackgroundScript(mv2Program) handleMV3HotCsp(program)