本文介紹了Electron Builder:不允許加載本地資源:app.asar/build/index.html的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!
問題描述
我在使用電子生成器時遇到問題,我在控制臺中出現空白頁和錯誤:
I have an issue when using electron builder I got blank page and error in console:
Not allowed to load local resource: file:///C:/Users/emretekince/Desktop/DCSLogBook/client/dist/win-unpacked/resources/app.asar/build/index.html
main.js
const startUrl = process.env.ELECTRON_START_URL || url.format({
pathname: path.join(__dirname, '/build/index.html'),
protocol: 'file:',
slashes: true
});
mainWindow.loadURL(startUrl);
推薦答案
通過在package.json中添加文件"解決
Solved by adding "files" in package.json
"files": [
"*.js",
"build",
"node_modules"
],
這篇關于Electron Builder:不允許加載本地資源:app.asar/build/index.html的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!
【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!