How should i exclude all node_modules in electron-packager
Asked Answered
S

1

9

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.

Sight answered 23/3, 2018 at 9:27 Comment(3)
I recommend using either electron-forge npmjs.com/package/electron-forge or electron-builder github.com/electron-userland/electron-builder to make your life easy. Unless you have a very special use case those packages will make things easier and faster.Guessrope
I highly discourage the use of electron-forge because the dependencies to electron-compile and electron-packer. Both are very flawed especially electron-compile (outated transpilers, flawed path handling for scss and the list goes on). electron-builder on the other hand is the right tool, it will exclude all devDependencies from the "release" node modules.Udall
electron-forge uses electron-packager to do its packaging anywayWolframite
W
22

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.

Wolframite answered 23/3, 2018 at 18:34 Comment(1)
I had to use !node_modules/**/*.Nonah

© 2022 - 2024 — McMap. All rights reserved.