ATTENTION: this command messes with your directory structure. In its current state it should be used with caution. Make a backup of your project first.
npm dedupe ignores modules that are symbolic links (e. g. when using
resulting in incomplete deduplication.
npm-dedupe-symlinks was created to dedupe the current working directory,
even if the
node_modules folder contains symbolic links. It does so by creating
a directory structure without any symbolic links, then using
npm dedupe and
recreating the symbolic links.
It can handle the following constellations:
It currently does not work for symbolic links that are nested deeper in the
directory hierarchy than one level (except for linked modules inside
npm install -g npm-dedupe-symlinks cd /to/the/package/i/want/to/dedupe npm-dedupe-symlinks
If the command fails, you may need to re-create your symbolic links. Dependencies might be lost as well.
Be warned: if you have one module symlinked into multiple projects, not all of those projects may work due to missing (deduped) dependencies.
# after cloning, run once npm run build # there's also a watcher npm run watch:build
package.jsonfrom the link's target to the empty directory
node_modulesdirectory from the link's target to the empty directory
node_modulesdirectory (if it still exists) back to the link target
It uses RxJS internally.
node_modulesdirectory is slow
Make sure everything is on the same volume.