How to use ignore files when packaging
See original GitHub issueelectron-builder: 3.16.0
I have a project setup using the two package.json structure. Everything works fine now, but I need to dynamically ignore files from the package. To do this, I am switching from the CLI to the API.
My current build
command is:
build --arch ia32 --platform win32 -d
I have changed it to the following script:
'use strict';
const builder = require('electron-builder');
const opts = {
platform: [builder.Platform.WINDOWS],
arch: 'ia32',
dist: true,
devMetadata: {
build: {
win: {
ignore: function (file) {
// TODO: add logic here
console.log(file);
return false;
}
}
}
}
};
builder.build(opts)
.catch((err) => {
console.log(err);
process.exit(1);
});
However, the ignore
field is not being read; all files are packaged and all the filenames are not being printed. Any idea on why this is?
Issue Analytics
- State:
- Created 7 years ago
- Comments:12 (4 by maintainers)
Top Results From Across the Web
How to ignore files from your npm package | Zell Liew
First, npm will check your repository for a .gitignore file. If there is a .gitignore file, npm will ignore files according to what's...
Read more >What Really Gets Packaged?. Including and excluding files in ...
I'd recommend using the files section in the package.json file over ... In fact, the .npmignore file and the .gitignore file are ignored....
Read more >How can I exclude files in my .gitignore when packaging a ...
I have the package installed globally, in my python's site-packages ... Then you can use those files to package the egg however you...
Read more >.gitignore file - ignoring files in Git | Atlassian Git Tutorial
Git ignore patterns are used to exclude certain files in your working directory from your Git history. They can be local, global, or...
Read more >Ignore files when building debian package
It is very unusual to use low level commands like dpkg-deb to build debian packages - this looks like a XY-problem. Usually, you...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Just leaving a comment here for anyone else who lands up searching for how to ignore files. You do that using the files configuration https://www.electron.build/configuration/contents#files.
e.g.
It was not immediately clear to me from the documentation how to ignore files.
Ok so i dropped by app size by around 80% just using the ignore function on the node_modules directory:
Could really use glob for this. keep in mind that some should not be ignore in some app cases (html, xml,…)