Repository navigation
react and react-dom dependencies should have caret range #1663
Description
Activity
johann-sonntagbauer commented
on Feb 27, 2017 ContributorMore actions@gaearon it is kinda wired.
Initializing a project withcreate-react-appwill install the dependencies withexactflag which was introduced with #1253
BUT
there also exists an init script (https://github.com/facebookincubator/create-react-app/blob/master/packages/react-scripts/scripts/init.js) which will install the dependencies without theexactflag. Is that init script needed at all any more?johann-sonntagbauer commented
on Feb 27, 2017 ContributorMore actionsmy suggestion would be as you already mentioned to remove the
exactflag and pin react-scripts version AND remove the code path in theinit.jsThe init script only does this for backwards compatibility with older global CLIs. It is still necessary because we want older CLIs to keep working.
johann-sonntagbauer commented
on Feb 27, 2017 ContributorMore actionsthx for clearing that up. One additional question, there exists some mechanism to install additional dependencies listed in a templates.dependeny.json file That mechanism is obsolete?
No, that that code is used for our kitchensink e2e.
johann-sonntagbauer commented
on Feb 27, 2017 ContributorMore actionsok :) lots to learn here
Tried out some variants with installing different versions with npm and it seems that it is not possible to install with different modes during an single install. The dependecies will be downloaded and installed with the correct version pattern, but the dependencies in the package.json will all get the same version range.
e.g.
npm install react@^15.0.0 react-dom@^15.0.0 react-scripts@0.9.1 --save "dependencies": { "react": "^15.4.2", "react-dom": "^15.4.2", "react-scripts": "^0.9.1" } npm install react@^15.0.0 react-dom@^15.0.0 react-scripts@0.9.1 --save --save-exact "dependencies": { "react": "15.4.2", "react-dom": "15.4.2", "react-scripts": "0.9.1" }One way to solve that would be to patch the package.json upfront and afterwards trigger an install.
Yes, we already patch up
package.jsonafter install so I just suggest adding an extra character there.johann-sonntagbauer commented
on Feb 27, 2017 ContributorMore actionsTHX that will be a perfect spot. Try to formulate a PR.
Reacted by dan and Joe HaddadFixed in #1669. Thanks @johann-sonntagbauer!
- locked and limited conversation to collaborators
on Jan 22, 2019
I think #1253 made it so that
reactandreact-domare also installed with exact range:This is not right. We want to pin
react-scriptsbut leavereactandreact-domunpinned:The easiest way to do it would probably be to remove the
exactflag from the installation script inpackages/create-react-app/index.js, and instead pinreact-scriptsto a specific version in the same function that movesreact-scriptstodevDependencies(also in that file).