Electron-builder: Unable to exclude files from app.asar

Created on 4 Nov 2018  路  7Comments  路  Source: electron-userland/electron-builder

  • Version: 20.28.4 and
  • Target: all, but specifically I am currently testing mac

On my project the ability to excludes files by annotating them under the build section in package.json was working.

After adding electron-webpack. This now no longer works. I am seeing everything included in my app.asar file. I have attempted to exclude electron-webpack from my build process and only run electron-build, but I still see everything in app.asar. Here is my debug log from running DEBUG=electron-builder npm run pack

"pack": "electron-builder --dir",
directories:
  output: dist
  buildResources: src/assets
extraMetadata:
  main: main.js
files:
  - from: .
    filter:
      - package.json
      - '**/*'
      - src
      - '!webpack*'
      - '!.*'
      - '!config/jsdoc.json'
      - '!package.json'
      - '!docs'
      - '!private'
  - from: dist/main
  - from: dist/renderer
  - from: dist/renderer-dll
extraResources:
  - from: src/assets
    to: assets
    filter:
      - '!track*'
      - '!css'
appId: com.test.test
productName: Test Desktop
copyright: '漏 2018 Test, LLC.'
artifactName: '${name}-${version}-${os}-${arch}.${ext}'
publish:
  - provider: s3
    bucket: xxx
    storageClass: STANDARD_IA
    path: '${channel}/${os}'
  - provider: github
    owner: xxx
    repo: xxx
linux:
  files:
    - '!node_modules/@ffprobe-installer/darwin-x64/${/*}'
    - '!node_modules/@ffprobe-installer/win32-ia32/${/*}'
    - '!node_modules/@ffprobe-installer/win32-x64/${/*}'
    - '!node_modules/@ffmpeg-installer/darwin-x64/${/*}'
    - '!node_modules/@ffmpeg-installer/win32-ia32/${/*}'
    - '!node_modules/@ffmpeg-installer/win32-x64/${/*}'
  category: AudioVideoEditing
  description: Test desktop video processing and file uploader
  icon: src/assets/icon.png
  desktop:
    Name: Test-Desktop
    GenericName: Test Desktop
    X-GNOME-FullName: test-desktop
    Comment: Test desktop video processing and file uploader
    Type: Application
    Terminal: 'false'
    StartupNotify: 'false'
    Categories: AudioVideoEditing
mac:
  files:
    - '!node_modules/@ffprobe-installer/linux-ia32/${/*}'
    - '!node_modules/@ffprobe-installer/linux-x64/${/*}'
    - '!node_modules/@ffprobe-installer/win32-ia32/${/*}'
    - '!node_modules/@ffprobe-installer/win32-x64/${/*}'
    - '!node_modules/@ffmpeg-installer/linux-ia32/${/*}'
    - '!node_modules/@ffmpeg-installer/linux-x64/${/*}'
    - '!node_modules/@ffmpeg-installer/win32-ia32/${/*}'
    - '!node_modules/@ffmpeg-installer/win32-x64/${/*}'
  category: public.app-category.video
win:
  files:
    - '!node_modules/@ffprobe-installer/linux-ia32/${/*}'
    - '!node_modules/@ffprobe-installer/linux-x64/${/*}'
    - '!node_modules/@ffprobe-installer/darwin-x64/${/*}'
    - '!node_modules/@ffmpeg-installer/linux-ia32/${/*}'
    - '!node_modules/@ffmpeg-installer/linux-x64/${/*}'
    - '!node_modules/@ffmpeg-installer/darwin-x64/${/*}'
  certificateFile: private/test.pfx
  verifyUpdateCodeSignature: false
  publisherName: trackops
extends: electron-webpack/electron-builder.yml
electronVersion: 3.0.7
backlog

Most helpful comment

i'm also having the issue! in my package.json i'm limiting files to a folder with precompiled files (via webpack) and an assets folder

"files": [
      "dist/electron/**/*",
      "assets/core/**/*"
    ],

which results in yaml:

files:
  - filter:
      - dist/electron/**/*
      - assets/core/**/*

but my whole repo gets bundled into the app. i'm on macOS, electron-builder is 20.38.4

All 7 comments

It seems bug in the merge parent and project configs. I will take a look tomorrow morning CET.

@develar - I updated to [email protected]. I am still seeing the files/directories that were requested to be filtered out in the files section under the build. Here is the run script I am using.

"build:mac": "rimraf dist && electron-webpack && electron-builder -m"

My debug is the same as I previously submitted. What else might I be missing?

These are the YAML files generated during the build
builder-debug.txt
builder-effective-config.txt

Is it possible to provide test project?

@develar thanks for looking into this item. I have setup a test project that has the issue. While setting up this project. I notice what was triggering the excludes not to work.

In the package.json you will see that I have a files section under the mac section in the build section. If I remove this file section, the the top level file section under the build seems to adhere to the excludes. If the file section under the mac section under the build exist, then the top level excludes don't work.

I have include the private directory as the example I wish to exclude. on your first build npm run build:mac you will notice that the generated app.asar has the private directory include. Now, delete the files listing under the mac section and build again. This time the app.asar does not have the private directory.

I hope this helps

@develar Any updates to share. Where you able to replicate the issue with the test project I setup?

i'm also having the issue! in my package.json i'm limiting files to a folder with precompiled files (via webpack) and an assets folder

"files": [
      "dist/electron/**/*",
      "assets/core/**/*"
    ],

which results in yaml:

files:
  - filter:
      - dist/electron/**/*
      - assets/core/**/*

but my whole repo gets bundled into the app. i'm on macOS, electron-builder is 20.38.4

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Was this page helpful?
0 / 5 - 0 ratings