electron-builder icon indicating copy to clipboard operation
electron-builder copied to clipboard

how to exclude node modules in app/node_module

Open wangxiexe opened this issue 10 years ago • 7 comments

5.23.2

Windows

I am using webpack to compile my src code so most directories inside app\node_modules are not required for publish.

Is there a way to exclude them during the build process ? thanks!

wangxiexe avatar Aug 15 '16 06:08 wangxiexe

noticed there is already some docs, so will try it

https://github.com/electron-userland/electron-builder/wiki/Options#multiple-glob-patterns

wangxiexe avatar Aug 15 '16 06:08 wangxiexe

Do you use 2 package.json structure? Why such modules added as production deps, but not as dev? Yes, we don't filter out for 2 package.json structure, but it should be fixed if need. So you will not need extra configuration.

develar avatar Aug 15 '16 06:08 develar

yes, I use two 2 package.json structure, but I do not need some node modules inside app/node_module directory ( like react, which is very big ) as I have a compile version already, just do not want to include in the final asar

wangxiexe avatar Aug 15 '16 06:08 wangxiexe

Maybe you can move react dep to dev package.json?

develar avatar Aug 15 '16 06:08 develar

ok, thanks for your hint, will try and use filter like

  "files": [
    "**/*",
    "!node_modules/async${/*}",
    "!node_modules/classnames${/*}",
    ...

also works.

wangxiexe avatar Aug 15 '16 07:08 wangxiexe

Could you please explain me why such dependencies in the app package.json, but not in the dev?

develar avatar Aug 15 '16 07:08 develar

the reason is that we only do webpack build for the render process js files and not for the main.js in main.js it also required some packages and need to go with the asar file so we just put all these depended packages into app package.json

anyway, you gived me a gr8 hint that I will move these depended package for render process into outer package.json and remove the filter setting in the build config

Thanks.

wangxiexe avatar Aug 15 '16 08:08 wangxiexe