Skip to content
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

Access to script at '[http://localhost:5173/src/background/index.js] has been blocked by CORS #105

Open
kpripper opened this issue Feb 28, 2025 · 1 comment

Comments

@kpripper
Copy link

Access to script at '[http://localhost:5173/src/background/index.js] from origin 'chrome-extension://caapplnpkaphcokmjfaboianmbigfdcf' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

How is that possible? The extension doesn’t have access to itself?

@eneko0513
Copy link

eneko0513 commented Mar 2, 2025

@kpripper
Hello.
This issue is caused by another package used in this extension.
The discussion can be found at:
crxjs/chrome-extension-tools#971

For a quick fix, you can add host_permissions: ['<all_urls>'] to your manifest and add the following to your vite.config:

    legacy: {
      skipWebSocketTokenCheck: true,
    },

This appears to eliminate the error (it disappeared in my environment), though it's unclear whether this poses any security risks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants