我试图用我自己的webpack设置和配置来重新创建一个用create-react-app完成的React应用。一切正常,直到我遇到“内容安全策略”问题,如下所示:
Refused to execute inline script because it violates the following Content Security Policy directive: "default-src 'none'". Either the 'unsafe-inline' keyword, a hash ('sha256-ThhI8UaSFEbbl6cISiZpnJ4Z44uNSq2tPKgyRTD3LyU='), or a nonce ('nonce-...') is required to enable inline execution. Note also that 'script-src' was not explicitly set, so 'default-src' is used as a fallback.
我试图在项目public / index / html中使用不同参数的元标记中设置CSP标头,但没有结果。有时页面甚至没有显示。