Skip to content

Commit

Permalink
fix(safari): fix performance issue of v8.8.1 for Safari (#505)
Browse files Browse the repository at this point in the history
  • Loading branch information
iorate authored Jun 30, 2024
1 parent c8e33c1 commit 311853e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
1 change: 1 addition & 0 deletions scripts/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ async function createCopyFiles(context: Context): Promise<() => Promise<void>> {
"pages/popup.html",
...(watch && browser === "chrome" ? ["pages/watch.html"] : []),
"scripts/active.js",
...(browser === "safari" ? ["scripts/import-content-script.js"] : []),
"third-party-notices.txt",
];
if (watch) {
Expand Down
8 changes: 6 additions & 2 deletions src/manifest.json.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export default {
process.env.BROWSER === "safari"
? Object.values(SEARCH_ENGINES).flatMap(({ contentScripts }) =>
contentScripts.map(({ matches, runAt }) => ({
js: ["scripts/content-script.js"],
js: ["scripts/import-content-script.js"],
matches: [
...new Set(
matches.map((match) => {
Expand Down Expand Up @@ -118,5 +118,9 @@ export default {
},
],
}
: {}),
: process.env.BROWSER === "safari"
? {
web_accessible_resources: ["scripts/content-script.js"],
}
: {}),
};
1 change: 1 addition & 0 deletions src/scripts/import-content-script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import("./content-script.js");

0 comments on commit 311853e

Please sign in to comment.