When I use npm install, there are certain node packages that gets installed that contains nested node modules.
Like this:
-node_modules
-packageA
+js
-node_modules <--- needs to be removed/ignored
+jquery
-packageA-sub1
+js
-node_modules <--- needs to be removed/ignored
+jquery
Is there a way to specify which packages not to include a nested scoped node_module?
In my case, there are packages that are including jquery (packageA and packageA-sub1, sub2, sub3, sub4, etc), and it's messing up my website because I already include jquery in a few of my plugins. The only way to remedy this is by manually deleting the node_module folder inside the packageA folder.
I tried .npmignore but that doesn't seem to work:
packageA/node_modules/
packageA/node_modules
/packageA/node_modules
/packageA/node_modules/
I'm using npm 5.8
You can flatten the node_modules
hierarchy, when modules share dependencies with the same version, using npm dedupe
The documentation describes npm dedupe
as follows:
Searches the local package tree and attempts to simplify the overall structure by moving dependencies further up the tree, where they can be more effectively shared by multiple dependent packages.
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.