I'm working on private library of react components. I've already setup the whole workflow etc. but I'm not sure about one thing.
In my library I have some packages listed as peerDependencies
which have to be peer ones (for example react
, cuz only one instance of react can be installed at once, otherwise everything breaks). But if I'd like to setup some tests in my library I need react
installed there as devDependency
.
So I have to install react as peer
and dev
in library. And what happens when I publish this package to npm register? devDependencies
are excluded here?
Thanks!
If you create a node package, and you have some dev dependencies, npm wont count them for the publish. That's why it's called devDependencies
. It's not under the production code.
I know you have to specify when installing an npm package --save-dev so it saves dependencies onto your json file.
If you need it in production, add it to peerDependencies
. Otherwise, leave it in devDependencies
. When someone installs your library, dev dependencies won't be installed, and peer dependencies should already be installed.
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.