Skip to content

Commit

Permalink
chore: disable use_dynamic_url as Chrome 130 is obviously not ready f…
Browse files Browse the repository at this point in the history
…or it (#22)

Crxjs enable
[use_dynamic_url](https://developer.chrome.com/docs/extensions/reference/manifest/web-accessible-resources)
by default on development for no reason and it actually did nothing
before Chrome 130.

Chrome 130 enable the ability of
[use_dynamic_url](https://developer.chrome.com/docs/extensions/reference/manifest/web-accessible-resources)
but things below are broken:

1. `import()` in a content script will fail due to [CSP
reason](crxjs/chrome-extension-tools#918)
2. `chrome.runtime.action.setPopup` will fail for a dynamic url.

Ref:

- https://developer.chrome.com/blog/extension-news-october-2024
-
https://groups.google.com/a/chromium.org/g/chromium-extensions/c/Nr3QNKFv74c/m/PYLvA7dOAAAJ
  • Loading branch information
xc2 authored Oct 16, 2024
1 parent c06c364 commit 385707a
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 2 deletions.
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@
"overrides": {
"@webcomponents/custom-elements": "link:./empty",
"[email protected]": "^2.79.2"
},
"patchedDependencies": {
"@crxjs/vite-plugin": "patches/@crxjs__vite-plugin.patch"
}
}
}
21 changes: 21 additions & 0 deletions patches/@crxjs__vite-plugin.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
diff --git a/dist/index.mjs b/dist/index.mjs
index c543f3e83ffb5210495ac735f9a906e59b9da491..d40cc9536ff6491702a7ae40b85a024f88a1adef 100644
--- a/dist/index.mjs
+++ b/dist/index.mjs
@@ -1838,8 +1838,6 @@ const pluginWebAccessibleResources = () => {
matches: ["<all_urls>"],
// all resources are web accessible
resources: ["**/*", "*"],
- // change the extension origin on every reload
- use_dynamic_url: true
};
if (browser === "firefox") {
delete war.use_dynamic_url;
@@ -1921,7 +1919,6 @@ const pluginWebAccessibleResources = () => {
const resource = {
matches: isDynamicScript ? [...dynamicScriptMatches] : matches,
resources: [...assets, ...imports],
- use_dynamic_url: isDynamicScript ? dynamicScriptDynamicUrl : true
};
if (isDynamicScript || !injectCss) {
resource.resources.push(...css);
9 changes: 7 additions & 2 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 385707a

Please sign in to comment.