NPM packages are mixing --save and --save-dev?

so on this page , going through installing the basics :

first link npm install code is :

npm install @babylonjs/core --save

materials is:

npm install --save @babylonjs/core @babylonjs/materials

next is loaders :

npm install --save-dev @babylonjs/core @babylonjs/loaders

except now it makes core save-dev instead of just save …? why

next post-process :

npm install --save @babylonjs/core @babylonjs/post-processes

now core is again just --save

then inspector :

npm install --save-dev @babylonjs/core @babylonjs/inspector

now core is again --save-dev


following this process , package.json looks like this :

 "dependencies": {
    "@babylonjs/materials": "^7.8.2",
    "@babylonjs/post-processes": "^7.8.2",  
  "devDependencies": {
    "@babylonjs/core": "^7.8.2",
    "@babylonjs/inspector": "^7.8.2",
    "@babylonjs/loaders": "^7.8.2",

If you use a bundler without marking those as external, they should all be devDependencies cause only used during the bundle creation.

But if you use tsc only to create a package or a bundler stating them as externals, you then need them as either dependencies or peer dependencies.

I guess in the doc case they could all be --save-dev

Do you want to make a PR to the doc ?

the npm install code is not in the doc , the links to the npm pages are… its on those npm pages that the code has this mix match

1 Like

cc @RaananW then :slight_smile:

Avoid using --save-dev in by RaananW · Pull Request #15139 · BabylonJS/Babylon.js (

should it not be the other way around? As @sebavan mentioned , for build tools that bundle, it should not be a dependency , and this is arguably how anyone using es6 NPM modules is using them.

The links in the docs are from the section describing modules for tree shaking ( the modules with the @ symbol in front ) , tree shaking cant happen without bundling right…

My 2 cents - you should decide where you save your dependencies, as a developer using npm. We should be consistent - either in dev or not in dev. When we say “install the dependency”, you need to decide where it fits.

There is no different in dev vs non-dev dependencies, if you are not planning to release an npm package. At least not at the moment :wink: I assume that if you are a developer who is planning on releasing a babylon.js plugin, you would know that it needs to be in dev (and probably in peer) dependencies. We just need to be consistent - and I totally agree with you here.