Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Electron Builder: Not allowed to load local resource: 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);
like image 445
Emre Tekince Avatar asked Jul 10 '17 21:07

Emre Tekince


2 Answers

Solved by adding "files" in package.json

"files": [
  "*.js",
  "build",
  "node_modules"
],
like image 57
Emre Tekince Avatar answered Oct 20 '22 23:10

Emre Tekince


I tried to fix this my whole day & finally found the solution,

"build": {
"appId": "myledgerapp",
"extends": null,
"files": [
  "./build/**/*",
  "./public/electron.js"
]}

We need to add files in build section where electron.js is my entry point.

like image 41
Akashxolotl Avatar answered Oct 20 '22 23:10

Akashxolotl