question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

electron-builder ignores directories named `build` in `files:` configuration

See original GitHub issue
  • Version: electron-builder@16.2.1

  • Target: Any

create-react-app by default outputs to a directory named build/. With a electron-builder.yml structured like so:

files:
  - electron/
  - node_modules/
  - build/

The build/ directory is excluded. Most likely due to some internal logic.

It’s also unfortunate that setting files: really means asarFiles, and setting it manually overwrites the default values (IE you won’t get node_modules/), and that there’s no equivalent extraAsarFiles.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
lexectedcommented, Aug 21, 2018

@mikew God bless your cow, that worked! Thanks for sharing.

So, yes, @develar, as OP mentioned, the directory named “build” does indeed get ignored and has to be explicitly put into “files” option in configuration, like so

"build": {
    "appId": "appid",
    ...
    "files": [
      "scripts/",
      "node_modules/",
      "build/",
      "!node_modules/.cache/",
      "!**/*.map"
    ]
  }

This comes as an issue for most of the people doing a webpack build before packaging the things to be used with electron, and is definitely an issue for anyone who started with create-react-app.

1reaction
joeyminkcommented, Apr 20, 2017

I don’t see how @develar’s suggestion helps this issue. setting directories.output, say, in package.json like this:

{
  "build": {
    "directories": {
      "output": "custom-output"
    }
  }
}

changes electron-builder’s output folder from the default dist/ to custom-output/. It doesn’t seem to affect the OP’s issue (and my issue at the moment) at all (the build/ folder is still ignored). Might I be missing something?

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to exclude file when build electron with electron-builder?
I provide a file like config.json for user to edit some custom config, then the application could read the file to do something....
Read more >
Application Contents - electron-builder
Development dependencies are never copied in any case. You don't need to ignore it explicitly. Hidden files are not ignored by default, but...
Read more >
Common Configuration - electron-builder
If you want to use js file, do not name it electron-builder.js . It will conflict with electron-builder package name. Tip. If you...
Read more >
File Patterns - electron-builder
** If a “globstar” is alone in a path portion, then it matches zero or more directories and subdirectories searching for matches. It...
Read more >
Command Line Interface (CLI) - electron-builder
Commands: electron-builder build Build [default] electron-builder install-app-deps ... format) --projectDir, --project The path to project directory.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found