Skip to content

Commit

Permalink
fix: firefox script handling (#673)
Browse files Browse the repository at this point in the history
  • Loading branch information
louisgv authored Jul 10, 2023
1 parent 2d93f19 commit 9e7a52d
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 11 deletions.
2 changes: 1 addition & 1 deletion cli/create-plasmo/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "create-plasmo",
"version": "0.78.0",
"version": "0.79.0",
"description": "Create Plasmo Framework Browser Extension",
"main": "dist/index.js",
"bin": "bin/index.mjs",
Expand Down
2 changes: 1 addition & 1 deletion cli/plasmo/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "plasmo",
"version": "0.78.0",
"version": "0.79.0",
"description": "The Plasmo Framework CLI",
"publishConfig": {
"types": "dist/type.d.ts"
Expand Down
2 changes: 1 addition & 1 deletion core/parcel-config/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@plasmohq/parcel-config",
"version": "0.38.3",
"version": "0.38.4",
"license": "MIT",
"repository": {
"type": "git",
Expand Down
2 changes: 1 addition & 1 deletion core/parcel-transformer-manifest/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@plasmohq/parcel-transformer-manifest",
"version": "0.17.6",
"version": "0.17.7",
"description": "Plasmo Parcel Transformer for Web Extension Manifest",
"files": [
"dist",
Expand Down
17 changes: 10 additions & 7 deletions core/parcel-transformer-manifest/src/handle-background.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,9 @@ function handleMV3Background(program: MV3Data) {
function handleFirefoxMV3Background(program: MV3Data) {
const mv2Program = program as unknown as MV2Data
if (program.background?.service_worker) {
mv2Program.background.scripts = [program.background.service_worker]
delete program.background.service_worker
mv2Program.background = {
scripts: [program.background.service_worker]
}
}

handleMV2BackgroundScript(mv2Program)
Expand All @@ -65,11 +66,13 @@ function handleMV2BackgroundScript(program: MV2Data) {

if (hot) {
if (!program.background?.scripts) {
program.background.scripts = [
asset.addURLDependency(defaultBackgroundScriptPath, {
resolveFrom: __filename
})
]
program.background = {
scripts: [
asset.addURLDependency(defaultBackgroundScriptPath, {
resolveFrom: __filename
})
]
}
}
}
}
Expand Down

0 comments on commit 9e7a52d

Please sign in to comment.