Why do people store typescript's types as dependency in package.json (instead of devDep)? [duplicate]

喜夏-厌秋 提交于 2019-12-10 23:43:12

问题


I noticed in almost all tutorials or blog posts about typescript, people just install packages via npm for types and/or typescript related modules as dependency. This is compile-time related thing and end user will never have to load this, so for me logically this should all be impl. detail and thus go to devDependecies part of package.json. I'm assuming that I'm missing something and would like the compact yet reasonable answer :)


回答1:


While this was my standing back in '17 when this was written, I was shown evidence to the contrary. See the linked duplicate for more details.


Because they are lazy/ignorant of the difference.

@types should definitely be devDependencies, you don't want them installed when you npm i some-package, only when you clone the code and call npm i.

You are completely right.



来源:https://stackoverflow.com/questions/45839812/why-do-people-store-typescripts-types-as-dependency-in-package-json-instead-of

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!