我应该如何排除电子打包器中的所有 node_modules [英] How should i exclude all node_modules in electron-packager

查看:20
本文介绍了我应该如何排除电子打包器中的所有 node_modules的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 electron-packager 来创建我的应用程序的 electron.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

上述方法不起作用.知道如何在最终构建中排除所有文件夹/删除节点模块.

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,您可以将 glob 模式定义为 <配置中的代码>文件.在这种情况下 !**/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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆