Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

406
Visualizações
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 Respostas
Responde à pergunta

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 Relatório

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda