问题
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