electron-builder: extraResources get copied to the wrong folder on Linux/Windows

I am trying to build a .deb, and the folder that I specify in extraResources ends up in the wrong place.

Config:

"build": {
    "app-bundle-id": "apple.app.id",
    "app-category-type": "public.app-category.utilities",
    "productName": "Product",
    "asar": false,
    "extraResources": ["dist/"],
    "osx": {
      "background": "app/assets/bg.jpg",
      "icon": "build/icons/app.icns"
    },
    "linux": {
    }
  },
  "directories": {
    "output": "release"
  },

The intermediate packager output looks like

release/
|-Product-linux-x64/
  |-...
  |-resources/
  |-dist/
  |-...

When I install and run the .deb I electron gives me file not found errors looking for resources/dist/bundle.js and resources/dist/bundle.css.

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 15 (8 by maintainers)

Commits related to this issue

Most upvoted comments

Hey @develar, thanks for answering!

I’m building my app with webpack so the distinction between ‘application source code’ and ‘built javascript app’ is important, and I got confused about which corresponded to the electron-builder ‘app’ folder (it’s the built javascript app). So basically I was packaging up my source code and then trying to copy in the actual app 😄.

My working setup now looks like this:

  • src/ folder for my source code (es6) that will be compiled through webpack
  • app/ folder for my static source (main.js, app.html, etc.), built assets (bundle.js, bundle.css, etc), and package.json describing any external app dependencies that can’t be packaged with webpack (native dependencies mostly).
  • build/ folder for electron-builder related assets (icons, etc.)
  • asar turned off since it’s irrelevant when your entire app is ~4 files, and also it breaks ffi.Library

This is a project using a similar setup: https://github.com/xwartz/douban.fm. Would be worth, I think, adding a sentence to the documentation for people with related setups.

Fix:

  • extraResources must copy files into the same dir where electron app located (app.asar).
  • In addition to extraResources, extraFiles must be added to copy files as extraResources does before with one exception – on OS X into the Contents.

Will be implemented in the next major release.