Skip to content

Commit

Permalink
refactor(extension): load bg/sw script exclusively based on browser t…
Browse files Browse the repository at this point in the history
…arget

Although manifest accepts both at the same time, a warning
is displayed in the extension logs, which can be avoided
by using only the relevant one based on browser type
  • Loading branch information
mirceahasegan committed Feb 21, 2025
1 parent 6951ff2 commit 6a56bf3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 1 addition & 2 deletions apps/browser-extension-wallet/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@
"128": "icon128.png"
},
"background": {
"service_worker": "./js/background.js",
"scripts": ["./js/background.js"]
"service_worker": "./js/background.js"
},
"action": {
"default_popup": "popup.html"
Expand Down
3 changes: 3 additions & 0 deletions apps/browser-extension-wallet/webpack-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,10 @@ const transformManifest = (content, mode) => {
}
};
}
// Firefox: Reading text is only available for extensions with the Web Extension clipboardRead permission
manifest.permissions = [...manifest.permissions, 'clipboardRead'];
// The background script in Firefox is a hidden DOM page
manifest.background = { scripts: ['./js/background.js'] };
} else if (process.env.BROWSER === 'chrome') {
manifest.key = process.env.LACE_EXTENSION_KEY;
}
Expand Down

0 comments on commit 6a56bf3

Please sign in to comment.