Is there a way to reorganize node_modules?

There is a large and deep node_modules directory. And there are many subfolders with the same modules that are located in different subdirectories. Sometimes the same versions of modules are sometimes different from lower versions.

Is there a tool to reorganize node_modules to remove duplicates, put them in the root directory, and somehow a bunch of modules to optimize this?

+4
source share
1 answer

The NPM hierarchy is actually quite complex, and they worked hard to optimize it. The most that you lose here is the small disk space. If you really need to trim the package structure for your application, you can take a look at npm dedupe , which is built directly on npm and does exactly what you are asking for (combines duplicates as much as possible).

, node_modules, , node_modules . , , , , npm update, , , , . (.. NPM) npm dedupe, , .

, ( NPM ), node_modules , , node_modules . , package.json - (, :/).

, node_modules npm .

+3

All Articles