'Problem chrome content security policy react extension manifest
I created a very simple extension chrome but I have a problem I can not fix it, the problem is of Content Security Policy of google chrome please I need help for fix it and this is the error :
Refused to execute inline script because it violates the following Content Security Policy directive: "script-src 'self' blob: filesystem: chrome-extension-resource:". Either the 'unsafe-inline' keyword, a hash ('sha256-wkEhk1Pm58HZQSzT/oPAcIeUYSsJpEEGo2v2M1aGgTs='), or a nonce ('nonce-...') is required to enable inline execution.
Solution 1:[1]
React by default uses inline scripts which your browser will reject in an extension. Create a .env.production file in your react app and specify INLINE_RUNTIME_CHUNK=false
inside of it.
Source: https://gist.github.com/amad-person/f0ef85a2123a2e1fcf8052dcf09eef90
You can also do this by updating the build script in package.json file
"build": "INLINE_RUNTIME_CHUNK=false react-scripts build"
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Touqeer |