K
K
kreotech2018-05-01 09:49:39
JavaScript
kreotech, 2018-05-01 09:49:39

How to auto-include npm packages for the current configuration of a node.js application?

I am making my own assembler for web page layout projects. To simplify support in the future, I want to make a plugin architecture. Namely: if you need to include CSS preprocessors, or PostCSS, or something else.
As a result, a natural question arises. You can link the parts together. What about dependencies in package.json?
Putting all possible dependencies into package.json at once is not an option. The excess must be cut off.
Each plugin naturally needs its own npm packages. When connecting the plugin, they must be added to package.json, and removed when disconnected. Or maybe there are ways from the application itself to call the installation of the necessary packages and check if they are installed at the current moment?
Tell me in which direction to dig, otherwise I googled, nothing suitable was found.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Abcdefgk, 2018-05-01
@Abcdefgk

In fact, the package.json file does not play any role in the operation of the application. You can throw it out of any application on the Node - nothing will happen: everything will work as it used to.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question