You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using Typescript for quite a while now I was surprised that create-react-app guide for adding types says that you have to execute the following command: yarn add typescript @types/node @types/react @types/react-dom @types/jest.
In other words add dependencies that are being used only in development to the dependencies that are supposed to end up in the final build files. (At least that's how I understood the difference between dev and non-dev dependencies)
From docs.npmjs.com about dependencies:
Please do not put test harnesses or transpilers in your dependencies object. See devDependencies, below.
My question is:
Why typescript, node-sass, types and such (seems that all install examples on the website are installing stuff to the dependencies) are not installed in devDependencies i.e. --dev?
P.S. I did read this discussion which seemed somewhat related, but still had this question in mind and wanted someone to make this clear once and for all.
The text was updated successfully, but these errors were encountered:
The distinction is meaningful for Node apps because they actually are deployed as runtime. So you might not want to deploy development dependencies.
In case of CRA, the end result is a static bundle. So in a sense all dependencies are "development dependencies", even React or libraries you use. They're used only at the build time.
But putting everything into build dependencies can break some deployment scripts that do the initial build on the server. So it's easier to put everything into regular dependencies instead.
Using Typescript for quite a while now I was surprised that
create-react-app
guide for adding types says that you have to execute the following command:yarn add typescript @types/node @types/react @types/react-dom @types/jest
.In other words add dependencies that are being used only in development to the dependencies that are supposed to end up in the final build files. (At least that's how I understood the difference between dev and non-dev dependencies)
From docs.npmjs.com about dependencies:
My question is:
Why typescript, node-sass, types and such (seems that all install examples on the website are installing stuff to the
dependencies
) are not installed indevDependencies
i.e.--dev
?P.S. I did read this discussion which seemed somewhat related, but still had this question in mind and wanted someone to make this clear once and for all.
The text was updated successfully, but these errors were encountered: