electron / packager

Customize and package your Electron app with OS-specific bundles (.app, .exe, etc.) via JS or CLI
https://npm.im/@electron/packager
BSD 2-Clause "Simplified" License
175 stars 17 forks source link

How to use --ignore to ignore a array #706

Closed eminoda closed 7 years ago

eminoda commented 7 years ago
--app
| -dist
| -src
| -node_modules
| .....

I use "package:win": "electron-packager . --ignore=src,node_modules --prune=true --overwrite --platform=win32 --arch=ia32 --out=out --icon=favicon.ico" but this result is ‘node_modules’ still exist.

malept commented 7 years ago

First, ignoring node_modules will likely cause your app to not work, because that's where everything in your dependencies section of package.json is installed. By default, all of your devDependencies are removed when preparing your app.

Second, to ignore multiple things, you have two options:

  1. Use the --ignore parameter multiple times
  2. Use the | feature of regular expressions, because as stated in the docs, ignore takes a regular expression.
eminoda commented 7 years ago

@malept tks for your reply。 looked the api,u say prune can ignore node-module。 but in ‘electron quick start demo’ didnt work? i tryed this way: "scripts": { "start": "electron .", "win": "electron-packager . --prune=true --ignore=src --ignore=e2e --overwrite --platform=win32 --arch=ia32 --out=out --icon=favicon.ico" } but in out node-modules still have logger my package.json: http://chuantu.biz/t6/13/1503216794x1700615998.png result: http://chuantu.biz/t6/13/1503216941x2918527080.png

eminoda commented 7 years ago

here is my sample:git@github.com:eminoda/angular4-electron.git

npm run win

out/xx/node_modules,have another modules,i just think there are logger &log4js in node_modules

malept commented 7 years ago

A few things:

eminoda commented 7 years ago

thanks a lot