-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
21 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import fs from "fs" | ||
// Temp fix for CSP on Chrome 130 | ||
// Manually remove them because there is no option to disable use_dynamic_url on @crxjs/vite-plugin | ||
// https://github.com/pnd280/complexity/commit/ce9242a0538e86b88ee455b2dea55598f6c779db | ||
function forceDisableUseDynamicUrl() { | ||
const manifestPath = "dist/manifest.json" | ||
const manifestContents = JSON.parse(fs.readFileSync(manifestPath, "utf8")) | ||
manifestContents.web_accessible_resources.forEach((resource: any) => { | ||
delete resource.use_dynamic_url | ||
}) | ||
if (!fs.existsSync(manifestPath)) { | ||
return | ||
} | ||
fs.writeFileSync(manifestPath, JSON.stringify(manifestContents, null, 2)) | ||
} | ||
forceDisableUseDynamicUrl() | ||
console.log( | ||
"Updated content.ts-loader and manifest for Content-Security-Policy fix." | ||
) |