简体   繁体   English

为什么Ember将所有内容安装为devDependencies而不是普通依赖项

[英]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. Ember CLI应用程序有一个package.json,它将所有内容列为dev依赖项。 Even stuff that is needed in the app's production version. 甚至是应用程序生产版本中需要的东西。 For instance packages like ember and ember-data are installed as devdependencies. 例如,ember和ember-data等软件包作为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 作为参考,这里是我正在谈论的样本: https//github.com/ember-cli/ember-new-output/blob/master/package.json#L17-L38

What's the reason for this? 这是什么原因?

In the context of application: 在申请的背景下:

As @Lux mentioned in the comments, you don't need them after the build. 正如@Lux在评论中提到的那样,在构建之后你不需要它们。

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. 我认为有一个意见是在应用程序的package.json文件中显示应用程序的所有插件依赖项。 By doing this way, you can prevent that an addon unintentially adds a js file to the build. 通过这种方式,您可以防止插件无意中将js文件添加到构建中。

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. 因此,管理依赖项的ember方法是将所有依赖项保留在devDependencies并使用默认蓝图将addon的所有依赖项添加到应用程序的package.json So the end user can tune them. 所以最终用户可以调整它们。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM