How should i exclude all node_modules in electron-packager

arun thatham picture arun thatham · Mar 23, 2018 · Viewed 10.8k times · Source

I'm using electron-packager for creating an electron.exe of my app. I need to exclude all node modules . I tried the following

--ignore=node_modules

The above is not working. Any idea how to exclude all folders/ remove node modules in final build.

Answer

Tim picture Tim · Mar 23, 2018

If you install modules as devDependencies, they will all be pruned automatically before packaging.

If you're using electron-builder you can define glob patterns as files in the config. In this case !**/node_modules/* will exclude all of node_modules.

If you're using electron-packager you can use the ignore option and regular expression to exclude files.