I have used create-react-app
to create my ReactJS app. Now, I see that due to some error in loading a chunk while bundling the code, some inline script is generated on the page. Due to this, the content-security policy which does not allow any inline script is violated. Can someone please suggest how to get rid of this inline script? Below is what I see in the generated source in the browser:
I resolved this by changing from true to false the INLINE_RUNTIME_CHUNK
value in .env.
There is a little more info in this answer: How to use React without unsafe inline JavaScript/CSS code?
Also consider breaking up into .env.development and .env.production
: What is the difference between .env.local and .env.development.local
?
---EDIT--- I cannot seem to flag this answer or report it but it is clearly copy pasted from this (https://stackoverflow.com/a/69095687/18092500) answer to another question from a year prior