gpt4 book ai didi

webpack - Electron 加载资源失败

转载 作者:行者123 更新时间:2023-12-03 12:20:33 25 4
gpt4 key购买 nike

我使用 https://github.com/pbarbiero/basic-electron-react-boilerplate但是在我的 macOS 上更新后,我无法再加载我的应用程序。

在检查器上,显示此错误:

Refused to execute inline script because it violates the following Content Security Policy directive: "default-src 'self'". Either the 'unsafe-inline' keyword, a hash ('sha256-Z+HxFhVCHMznEI/lLsU2FT9krRiVCTm6bGApEd5HAtk='), 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.

index.html Failed to load resource: the server responded with a status of 404 (Not Found)



我试过这种技术 https://electronjs.org/docs/tutorial/security#csp-http-header但得到了同样的错误。

我的 macOS 版本是 Mojave 10.14.2 (18C54)

最佳答案

我把它修好了:

new HtmlWebpackPlugin({
'meta': {
'Content-Security-Policy': { 'http-equiv': 'Content-Security-Policy', 'content': "script-src 'self' 'unsafe-inline'; object-src 'self'" },
}
}),

关于webpack - Electron 加载资源失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53995716/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com