-
Notifications
You must be signed in to change notification settings - Fork 190
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dev client worker capturing /_favicon/ request in chrome manifest v3 #618
Labels
bug
Something isn't working
Comments
stevezhu
changed the title
Dev client worker capturing /_favicon/ request
Dev client worker capturing /_favicon/ request in manifest v3
Dec 26, 2022
stevezhu
changed the title
Dev client worker capturing /_favicon/ request in manifest v3
Dev client worker capturing /_favicon/ request in chrome manifest v3
Dec 26, 2022
When is it expected to be repaired |
@stevezhu Found a solution? |
I included a fix to this issue, if it's not merged, you can link it locally, just make these changes: async function sendToServer(url: URL): Promise<Response> {
if (url.href.includes('/_favicon/')) {
const response = await fetch(url.href)
return new Response(response.body, {
headers: {
'Content-Type': response.headers.get('Content-Type') ?? 'text/javascript',
},
})
}
// change the url to point to the dev server
url.protocol = 'http:'
url.host = 'localhost'
url.port = __SERVER_PORT__
// add a timestamp to force Chrome to do a new request
url.searchParams.set('t', Date.now().toString())
// URLSearchParams adds "=" to every empty param & vite doesn't like it
const response = await fetch(url.href.replace(/=$|=(?=&)/g, ''))
// circumvent extension CSP by creating response from extension origin
return new Response(response.body, {
headers: {
'Content-Type': response.headers.get('Content-Type') ?? 'text/javascript',
},
})
} |
HarryYu02
added a commit
to HarryYu02/booktab
that referenced
this issue
Apr 26, 2024
…om capturing /_favicon/ request crxjs/chrome-extension-tools#618
The problem still exists. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Build tool
Vite
Where do you see the problem?
Describe the bug
I'm attempting to use the
/_favicon/
api from chrome manifest v3 shown here:https://github.com/GoogleChrome/chrome-extensions-samples/tree/main/api/favicon
It seems that due to the hmr client worker capturing all requests during dev, the requests to
/_favicon/
are also being captured instead of being handled by chrome.Reproduction
Use https://github.com/GoogleChrome/chrome-extensions-samples/tree/main/api/favicon with
@crxjs/vite-plugin
in dev mode.Logs
Failed request (when client worker is capturing requests):
Expected successful request:
System Info
Severity
annoyance
The text was updated successfully, but these errors were encountered: