~ $ mkdir tmp
~ $ cd tmp
~/tmp $ npm i --save mongoose@7.6.4
~/tmp $ npm i --save-dev copy-node-modules
~/tmp $ npm ls @mongodb-js/saslprep
tmp@ /home/mpsijm/tmp
└─┬ mongoose@7.6.4
└─┬ mongodb@5.9.0
└── @mongodb-js/saslprep@1.1.1 deduped
~/tmp $ mkdir dist
~/tmp $ npx copy-node-modules . dist
~/tmp $ cd dist
~/tmp/dist $ npm ls @mongodb-js/saslprep
/home/mpsijm/tmp/dist
└── (empty)
In this example, the nested dependency @mongodb-js/saslprep should be copied to dist/node_modules (as dependency of mongodb, but it's not. Note that mongodb itself is copied, even though its dependencies are not:
To reproduce:
In this example, the nested dependency
@mongodb-js/saslprep
should be copied todist/node_modules
(as dependency ofmongodb
, but it's not. Note thatmongodb
itself is copied, even though its dependencies are not:This is probably because
mongodb
exists at the top-levelnode_modules
folder, whereas@mongodb-js/saslprep
does not.System info: