Does it make sense to put any modules into package.json
dependencies
when I use webpack?
When I want to develope a package, I use git clone <url>
then npm install
, then npm installs all dependencies
and devDependencies
from package.json
file and it makes sense.
When I'm end-user and I just want to install some package into my node_modules
to use it in my project, I run npm install package-name
, then npm installs package-name
with only its dependencies
, and it makes sense too.
But does it make sense to put any modules into dependencies
when I use webpack
? The webpack will bundle all dependencies into eg. bundle.js
, so, for me, there is no need to install dependencies then (while they're included into bundle.js
file).
Let's assume that I put all neccessary modules into devDependencies
(keep the dependencies
object empty) for my project: my-project
, bundle it with webpack and publish:
- the developer-user will use
git clone <url to my_project>
, then runnpm install
, then npm will installdevDependencies
frompackage.json
(and ommit emptydependencies
object), then it is ready to develope. - the end-user will use
npm install my-project
, then npm will installmy-project
, do not installdevDependencies
(because this is for production) and do not installdependencies
(becausedependencies
object inpackage.json
remain empty). Putting anything intodependencies
would double the dependencies: both the dependencies would be installed, and the same dependencies would be accessible in thebundle.js
file.
Am I right?