Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does Ember installs everything as devDependencies instead of normal dependency

Ember CLI applications have a package.json that lists everything as a dev dependency. Even stuff that is needed in the app's production version. For instance packages like ember and ember-data are installed as devdependencies.

As a reference, here's a sample of what I'm talking about: https://github.com/ember-cli/ember-new-output/blob/master/package.json#L17-L38

What's the reason for this?

like image 457
Ernesto Avatar asked Feb 10 '17 12:02

Ernesto


People also ask

What is difference between devDependencies and dependencies?

A dependency is a library that a project needs to function effectively. DevDependencies are the packages a developer needs during development.

Which command will install both dependencies and devDependencies?

When you (or another user) run npm install , npm will download dependencies and devDependencies that are listed in package. json that meet the semantic version requirements listed for each.

Which packages should be in devDependencies?

devDependencies should contain packages which are used during development or which are used to build your bundle, for example, mocha, jscs, grunt-contrib-watch, gulp-jade and etc.

Why do you need devDependencies?

devDependencies are those packages in the package. json file that you need only for project development purposes. Example- Babel, Webpack, etc. You require these packages to test and run your project on the localhost.


1 Answers

In the context of application:

As @Lux mentioned in the comments, you don't need them after the build.

The output of the application is the build, that is supposed to be the final product. Further, you generally don't depend on another application. You generally depend on a package or an addon.

In the context of addons:

I think there is an opinion to display all of the addon dependencies of an application at the application's package.json file. By doing this way, you can prevent that an addon unintentially adds a js file to the build.

As a result, the ember way of managing dependencies is to leave all of your dependencies at your devDependencies and add all of the dependencies of the addon to the application's package.json with default blueprints. So the end user can tune them.

like image 119
ykaragol Avatar answered Oct 02 '22 10:10

ykaragol