Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

412
Views
Electron packager ignore folder contents from the root level

I am trying to use electron-packager to package an electron app. When packaging my app I want to ignore the entire contents of certain folders. Using the --ignore flag you can pass a regular expression to electron-packager to tell it to ignore matches.

My folder structure looks like

app
|--build
|--node_modules
|--src
index.html
main.js
package.json

Using the method from the accepted answer of this question I prepended my expression with ^ to restrict the pattern to the root level.

let execArgs = `npx electron-packager ./ "${productName}"`
    + ` --platform=win32`
    + ` --out=${outPath}`
    + ' --ignore=^/build';
execSync(execArgs);

However, electron-packager appears to still be ignoring more than just the specific folders. If I try running the packaged app I get the error Error: Cannot find module '../helpers/buildURL'. The full relative path of this file is ./node_modules/axios/lib/helpers/buildURL.js.

If I comment out the line ignoring the build folder, I no longer get the error above.

// + ' --ignore=^/build'

How can I make electron-packager ignore specific folders and their contents from the root level?

about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

Looks like all I had to do was surround my argument in quotes.

+ ' --ignore="^/build"';

I'm not sure why this made a difference, since my argument does not include any spaces, but when I surrounded it in quotes the expression ignored only the correct files.

about 4 years ago · Juan Pablo Isaza Report

0

I always use this script to ignore files when I package an electron app

script{"electron-build":"electron-packager . MYAPP --ignore build/* }

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!