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
{{ message }}
Repository navigation
Package react-scripts is installed as not a dev dependency #2696
This is intentional as your application relies on polyfills provided by the package, warrantying a dependency.
As a side effect, deploying to Now and Heroku is easier.
@gaearon, what was the reasoning for this change? I found it pretty confusing (so I opened the ticket) since it's expected behavior after 6+ years of using NPM.
It fixes deployment issues on some hosting providers that assume only dependencies are needed for the build. The line is also very thin in frontend development. None of them are "runtime" dependencies because we don't have a server and they all get bundled into a single file. So if we were pedantic then we would have to declare everything as devDependencies, including React itself. I just figured that it's not worth conceptual overhead anyway since distinction is largely arbitrary. For example polyfills could be categorised as either.
Reacted by Antti Ahti, Peter Hrynkow , Larry and Nathan Broadbent
Reacted by Monarch Wadia, Prashanth Puranik, David Karlsson and Zoltan
Sure, but we generally try for more things to work out of the box.
This is a good example of an issue that can be debated endlessly because there's very little technical arguments for and against. I've made a choice there and if you disagree, you can always move those few lines.
Reacted by Oleksii, dave@backlit.studio, Eugene Kulabuhov, Jay and Nathan Broadbent
Reacted by Prashanth Puranik, JustJoey, Cezar Sîrbu, Antti Ahti, Cassidy Bridges, Mike Chabot, fqborges, Piotr Karpala, Urvashi Gupta, Praveen Sampath and 2 more
Reacted by Cezar Sîrbu, Cassidy Bridges, Kristie Howard, Abhijit Parida, Joni Rämö and Zoltan
You can move it in your package.json and then there is no problem.
Again, unless you’re building a Node.js app, the most correct semantics would be to put everything into devDependencies including react and any libraries you’re using. But there are practical reasons why this is undesirable so we just went with the opposite approach.
react is a dependency because it is included in the final build. A polyfill, such as one for something like <details> would be treated the same. Something like babel is not, and is therefore a devDependency. I'd probably put something like babel-polyfill in devDependencies. With that, react-scripts would follow suit.
Reacted by Ruslan @doasync, Piotr Karpala, Urvashi Gupta and Justin Meiners
Activity
yakhinvadim commentedon Jun 30, 2017
This is intentional and was made in v1.0.8. See #2657
Timer commentedon Jun 30, 2017
This is intentional as your application relies on polyfills provided by the package, warrantying a dependency.
As a side effect, deploying to Now and Heroku is easier.
alexeyraspopov commentedon Jun 30, 2017
@gaearon, what was the reasoning for this change? I found it pretty confusing (so I opened the ticket) since it's expected behavior after 6+ years of using NPM.
gaearon commentedon Jun 30, 2017
It fixes deployment issues on some hosting providers that assume only dependencies are needed for the build. The line is also very thin in frontend development. None of them are "runtime" dependencies because we don't have a server and they all get bundled into a single file. So if we were pedantic then we would have to declare everything as devDependencies, including React itself. I just figured that it's not worth conceptual overhead anyway since distinction is largely arbitrary. For example polyfills could be categorised as either.
alexeyraspopov commentedon Jul 4, 2017
Couldn't it be done as just a part of Deployment/Troubleshooting part in README then?
gaearon commentedon Jul 4, 2017
Sure, but we generally try for more things to work out of the box.
This is a good example of an issue that can be debated endlessly because there's very little technical arguments for and against. I've made a choice there and if you disagree, you can always move those few lines.
stevenvachon commentedon Aug 6, 2017
The polyfills should be moved out to a "react-polyfills" package, then. "scripts" does not imply polyfills.
gaearon commentedon Aug 6, 2017
What technical problem are you having?
stevenvachon commentedon Aug 6, 2017
Semantics.
gaearon commentedon Aug 6, 2017
You can move it in your
package.jsonand then there is no problem.Again, unless you’re building a Node.js app, the most correct semantics would be to put everything into
devDependenciesincludingreactand any libraries you’re using. But there are practical reasons why this is undesirable so we just went with the opposite approach.stevenvachon commentedon Aug 7, 2017
reactis adependencybecause it is included in the final build. A polyfill, such as one for something like<details>would be treated the same. Something likebabelis not, and is therefore adevDependency. I'd probably put something likebabel-polyfillindevDependencies. With that,react-scriptswould follow suit.jeremy-ww commentedon Nov 24, 2017
If you are using npm, run this command will move all packages except
ReactintodevDependencies.justinmeiners commentedon Jan 16, 2019
@gaearon I can no longer identify which licenses are used in production and which are just for build tools.