我在使用电子生成器时遇到问题我在控制台中有空白页面和错误:
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中添加“files”来解决
"files": [
"*.js",
"build",
"node_modules"
],