我应该如何排除电子打包程序中的所有node_modules [英] How should i exclude all node_modules in electron-packager
问题描述
我正在使用电子包装程序来创建我的应用程序的electronic.exe。我需要排除所有节点模块。我尝试了以下
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
--ignore=node_modules
以上操作无效。知道如何在最终版本中排除所有文件夹/删除节点模块。
The above is not working. Any idea how to exclude all folders/ remove node modules in final build.
推荐答案
如果将模块安装为 devDependencies
,将在打包之前将它们全部自动删除。
If you install modules as devDependencies
, they will all be pruned automatically before packaging.
如果您使用的是 electron-builder code>,您可以将全局模式定义为
文件
在配置中。在这种情况下,!** / node_modules / *
将排除所有 node_modules
。
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
.
如果您使用的是 electron-packager
,则可以使用 ignore
选项和正则表达式可排除文件。
If you're using electron-packager
you can use the ignore
option and regular expression to exclude files.
这篇关于我应该如何排除电子打包程序中的所有node_modules的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!