Skip to main content
electron-builder uses glob patterns to determine which files to include or exclude from your application package. Understanding these patterns is essential for controlling your application’s size and content.

Glob Pattern Syntax

Basic Patterns

Extended Patterns

Using File Patterns

Including Files

Define which files to include in your application:
package.json
If a directory is matched, all its contents are copied automatically. You can specify just foo to copy the entire foo directory.

Excluding Files

Use the ! prefix to exclude files:
package.json

Excluding Directories

Be careful when excluding directories. The pattern !doNotCopyMe/**/* would match the files IN the doNotCopyMe directory, but not the directory itself, creating an empty directory.
Solution: Use the ${/*} macro:
This correctly excludes both the directory and its contents.

Multiple Glob Patterns

Patterns are processed in order, allowing you to include exceptions to exclusions:

File Macros

You can use macros in file patterns, artifact names, and publish URLs. Macros are replaced at build time.

Available Macros

Using Macros in Patterns

package.json

Environment Variable Macros

electron-builder.yml
The ${ext} macro is also supported in artifact file name templates to represent the file extension.

Common Patterns

Development vs Production Files

Exclude Source Files

Platform-Specific Resources

Include Build Resources

Build resources (from the buildResources directory) are NOT packed into the app by default. If you need files like tray icons, explicitly include them in the files pattern.

extraResources and extraFiles

For files that should not be in the app.asar archive:

FileSet with Patterns

See Application Contents for more details on extraResources and extraFiles.

Performance Tips

  1. Be specific: Use specific patterns instead of broad patterns with many exclusions
  2. Exclude unnecessary files: Remove development files, documentation, and test files
  3. Use asarUnpack carefully: Unpacking too many files can slow down your app