Dev dependencies?


I find it strange to install components used in production as dev dependencies, isn’t that wrong? Tree shaking will take place regardless of the category, and imho core components (and such) are used in the code in production and should instead be installed as regular dependencies.

Else shouldn’t we also install every other dependencies (like, I don’t know, moment.js) as dev dependencies?

Asking our module master @RaananW

when packing, dev dependencies will be built and used the same as dependencies. The main difference between the two sections is how will your npm package be published, and what will be installed when another developer installs your package. If you are not planning on creating a package, there is little to no difference between the two.

If you are planning on publishing a package based on babylon, you need to decide where babylon fits in your dependencies, and - are you providing babylon as part of your package?. Should babylon be a peer dependency?

If I can ask - why are you asking this question? are we saying somewhere to use one over the other?

Oh yes, sorry, let me be more specific. My question is about providing a front application using Babylon.js.

Following your guide (Getting Set Up), you instruct to install core components as a dev dependency. And that’s why I’m asking, because the core is meant to be packed in the final package to be deployed, it’s not just a tool used to develop (like task runners, testing libraries, type definitions and such) and then removed in the build.

To give a meaning differentiating the standard and dev dependencies, it feels wrong to me. Maybe I am, I’m not judging, just asking.

My feeling is also based on the official documentation of Node.js (Specifying dependencies and devDependencies in a package.json file):

  • "dependencies" : Packages required by your application in production.
  • "devDependencies" : Packages that are only needed for local development and testing.

That’s the perfect definition, and is totally correct :slight_smile:

And I totally agree with you - you should have babylon in dependencies and not dev dependencies (in an app that uses babylon in production). However, if you pack your app (which you surely do), babylon will be included in your production code.

We should update our docs, that’s for sure :wink:

Okay, thanks for your answer. :wink:

Yes, but it was mainly about good/best practices.

And I totally agree with you. It is correct to pur babylon in dependencies and not dev-dependencies.