When adding the lein-npm
plugin to my re-frame
project to manage npm
dependencies, lein-npm
unexpectedly adds dependencies of dependencies. My understanding is that that's unnecessary, because those are either included in my dependency's jar or otherwise not required (because adding lein-npm
to my project is not required in the first place).
Using the re-frame
template, I construct this minimal example of my project.clj
:
(defproject stamm "0.1.0-SNAPSHOT"
:dependencies [[org.clojure/clojure "1.8.0"]
[re-frame "0.9.1"]]
:plugins [[lein-npm "0.6.2"]])
Calling lein npm list
now returns the following:
project@0.1.0-SNAPSHOT /path/to/my/project
├── UNMET DEPENDENCY karma@1.0.0
├── UNMET DEPENDENCY karma-chrome-launcher@0.2.0
├── UNMET DEPENDENCY karma-cljs-test@0.1.0
└── UNMET DEPENDENCY karma-junit-reporter@0.3.8
This leads to some 15 MByte of dependencies being downloaded, just by adding lein-npm
. I do not declare any of the karma*
dependencies shown here in my project.clj
(in fact: I do not declare any npm
dependencies at all at this point). They originate from the dependency [re-frame "0.9.1"]
.
Is there a way to prevent that?
I've released re-frame 0.9.2 which puts the NPM dependencies in the :devDependencies
key. This will mean that they are not transitive, and re-frame consuming projects won't need to install karma*
.
Original answer:
At the time of writing, I don't think there's a way to get around this, but I've opened an issue at https://github.com/RyanMcG/lein-npm/issues/50 to report it.