Closed MichaelVidStep closed 2 years ago
I have the same error after updating @crxjs/vite-plugin
.
The affected versions seem to be 1.0.7
– 1.0.11
.
I'm on Win 10 too.
@thetarnav @MichaelVidStep Could you provide the manifest.json
that causes the error? I'm especially interested in content script match patterns:
{
"content_scripts": [{
"matches": ["https://*.google.com/*"] // 👈 this array is what i need
}]
}
This error happens when the content script plugin tries to convert a match pattern from a content script into a match pattern for a web-accessible resource:
Then the error happens here:
I think I can refactor this so we get better errors and the code is easier to read.
Could you provide the manifest.json that causes the error?
https://github.com/thetarnav/solid-devtools/blob/main/packages/extension/manifest.ts I won't be surprised if it's full of errors — don't know what I'm doing really. I was copying vue-devtools I think.
@thetarnav Thanks for the quick repro! :pray: I'm pretty sure <all_urls>
triggers the bug. We can fix that.
Lots of devs use <all_urls>
, but Google kind of frowns on it; I've heard that it triggers a more thorough review when you publish it on the Chrome Web Store because it also runs on the file:
scheme.
I suggest switching to *://*/*
unless you really need to match the file:
scheme. Even then, I would use explicit match patterns. That makes the CWS review process more straightforward b/c they can tell you know what you're doing.
{
"content_scripts": [
{
"matches": [
"http://*/*",
"https://*/*",
"file:///*"
],
"js": [
"content/content.ts"
],
"run_at": "document_start"
}
]
}
This is something I'll have to check if we can support. I wonder if web_accessible_resources
supports <all_urls>
? Maybe we can map it to explicit match patterns.
Thank you, changing the pattern to *://*/*
seems to work just fine with the latest version.
As for the <all_urls>
, it probably would be better to support it, but give some sort of friendly warning about it. Just because the internet is filled with this pattern mentioned as an option.
@thetarnav Thanks for the quick repro! 🙏 I'm pretty sure
<all_urls>
triggers the bug. We can fix that.Best Practice
Lots of devs use
<all_urls>
, but Google kind of frowns on it; I've heard that it triggers a more thorough review when you publish it on the Chrome Web Store because it also runs on thefile:
scheme.I suggest switching to
*://*/*
unless you really need to match thefile:
scheme. Even then, I would use explicit match patterns. That makes the CWS review process more straightforward b/c they can tell you know what you're doing.{ "content_scripts": [ { "matches": [ "http://*/*", "https://*/*", "file:///*" ], "js": [ "content/content.ts" ], "run_at": "document_start" } ] }
Notes
This is something I'll have to check if we can support. I wonder if
web_accessible_resources
supports<all_urls>
? Maybe we can map it to explicit match patterns.
Yep this solved my problem. Thanks so much!
Build tool
Vite
Where do you see the problem?
Describe the bug
When I try to build my extension I get an error. I've tried removing several packages and modifying my manifest file with no luck so far.
Reproduction
Logs
System Info
Severity
annoyance