How transient dependencies and devDependencies works?

17 views
Skip to first unread message

Daniel Hilst Selli

unread,
Apr 4, 2018, 12:48:06 PM4/4/18
to nodejs
I have this library: https://github.com/dhilst/webpacklibraryexample

I can install it by running npm install --save git+https://github.com/dhilst/webpacklibraryexample.git

The "prepare" scripts runs webpack which bundles the library (I can see the dist/ folder), but I can't see any devDependencies of webpacklibraryexample installed at node_modules or node_modules/webpacklibraryexample or anywhere. Where are they!? What kind of dark magic is this?

I created this code because I facing another problem which I was trying to reproduce, the original problem is a major library that wont build when installed as dependence or dev dependence. At beginning it wont install the devDependencies, so the webpack wasn't found during postinstall script. I solved this by using this "postinstall": "npm installl & webpack" but now it fails to build because some loader is missing, so flow stuff is considered syntax error.

I have no idea about how npm deals with dependencies. My intuition says that when you install a package it install its dependencies and devDependencies at node_modules folder, or inside node_modules/<dep>/node_modules and so on, ... as long as npm config get production is false. But in the first case I can't see the dev deps installed and in the second it there are missing stuff. I'm really lost,

Regards,


Reply all
Reply to author
Forward
0 new messages