Electron Builder:不允许加载本地资源:app.asar/build/index.html [英] Electron Builder: Not allowed to load local resource: app.asar/build/index.html

查看:22
本文介绍了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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆