-
-
Notifications
You must be signed in to change notification settings - Fork 27.2k
Description
It is a common convention for build tools to be in devDependencies instead of dependencies. I have noticed that create-react-app generates a package.json with only dependencies, and I think the react-scripts dependency counts as a build and testing tool which can be moved to devDependencies. If this hasn't already been discussed and it's possible for us to try it, I can start a PR on the template generator.
Note that even though react-scripts generates production code, npm still considers it a build tool that is not necessary in production environments because it does not produce code that relies on native Node bindings in production. Users can still safely install devDependencies in production environments if they can't build outside of their production environment, though I feel this is uncommon with GitHub Pages and Travis being so popular.
According to the npm docs for devDependencies:
If someone is planning on downloading and using your module in their program, then they probably don't want or need to download and build the external test or documentation framework that you use.
In this case, it's best to map these additional items in a devDependencies object.
These things will be installed when doing npm link or npm install from the root of a package, and can be managed like any other npm configuration param. See npm-config for more on the topic.
For build steps that are not platform-specific, such as compiling CoffeeScript or other languages to JavaScript, use the prepare script to do this, and make the required package a devDependency.