简体   繁体   中英

Best way to implement optional modules for node.js app

I'm looking to create an app with optional modules that I will not know the names of in the application.

For example, imagine outlook, but the calendar/tasklist/mail pieces are optional components, you would npm install outlook-framework then create your app that requires "outlook-framework" but then I would like to import all packages installed that start with "outlook-". So I can npm install outlook-mail and that gives me email support, same for outlook-calendar , or even something I didn't write, maybe outlook-twitter or outlook-rss (or thirdpary-outlook-module )

Is there some existing mechanism for loading modules like this? Or does anyone have any better ideas for loading unknown, optional modules?

Thanks!

我已经决定,这些软件包将需要具有清单,例如“ outlook-manifest.json”并加载模块,我将在node_modules中列出目录,找到具有清单的目录,然后加载这些清单。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM