How do I decide whether @types/* goes into `dependencies` or `devDependencies`?

后端 未结 3 1333
花落未央
花落未央 2020-12-04 06:07

I use TypeScript 2 in my project. I\'d like to use some js library, but also typings for that library. I can install types with simple npm install @types/some-library<

3条回答
  •  自闭症患者
    2020-12-04 07:02

    In the particular case of deploying a Node.js application to production, one wants to install only the dependencies needed to run the application.

    npm install --production or

    npm ci --production or

    yarn --production

    In that case, the types should be in the devDependencies, to keep them from bloating the installation.

    Remark: I'm aware this was mentioned in a comment by Brad Wilson to another answer. This point seems worthy to be an answer, though.

提交回复
热议问题