samrum / vite-plugin-web-extension

A vite plugin for generating cross browser platform, ES module based web extensions.
MIT License
334 stars 32 forks source link

Content Security Policy error for bundle js files #148

Open AnweshGangula opened 2 weeks ago

AnweshGangula commented 2 weeks ago

Since a week, I have been receiving below error when I'm trying to use my extension which was working fine. I did not make any change in the code.

Refused to load the script 'chrome-extension://2a0537bb-6706-4dfa-b5f7-c1675289a43c/assets/src/entries/contentScript/primary/main.d2e7ec72.js' because it violates the following Content Security Policy directive: "script-src 'self' 'wasm-unsafe-eval' 'inline-speculation-rules' http://localhost: http://127.0.0.1:". Note that 'script-src-elem' was not explicitly set, so 'script-src' is used as a fallback.

The script mentioned above is the bundled script file generated by running vite build

A question has been posted regarding this in stack-overflow.

SleepyStew commented 2 weeks ago

@AnweshGangula

Hey! I posted a solution in #146

AnweshGangula commented 2 weeks ago

I tried this out, it doesn't seem to solve the issue.

Looks like a similar issue was posted in crxjs: https://github.com/crxjs/chrome-extension-tools/issues/927