Skip to content

Commit 9d9b057

Browse files
Revert "Remove yarn < 1.5 workaround."
This reverts commit e188e1e.
1 parent e188e1e commit 9d9b057

File tree

1 file changed

+11
-1
lines changed
  • packages/react-scripts/scripts

1 file changed

+11
-1
lines changed

packages/react-scripts/scripts/init.js

+11-1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ const { defaultBrowsers } = require('react-dev-utils/browsersHelper');
2323
const os = require('os');
2424
const resolveFrom = require('resolve-from');
2525
const paths = require('../config/paths');
26+
const { findMonorepo } = require('react-dev-utils/workspaceUtils');
2627

2728
function isInGitRepository() {
2829
try {
@@ -177,10 +178,19 @@ module.exports = function(
177178
fs.unlinkSync(templateDependenciesPath);
178179
}
179180

181+
// yarn ws not creating app/node_modules/.bin link to hoisted react-scripts
182+
// -- workaround: install react-scripts again to create link
183+
// -- bug in yarn 1.3.2, fix verified in nightly 1.4.1-20180211.2236 and 1.5.1
184+
// TODO: remove this workaround when CRA enforces min yarn version
185+
const rerunYarn = useYarn && findMonorepo(appPath).isAppIncluded;
186+
if (rerunYarn) {
187+
console.log('Detected app in yarn workspace, running install again');
188+
}
189+
180190
// Install react and react-dom for backward compatibility with old CRA cli
181191
// which doesn't install react and react-dom along with react-scripts
182192
// or template is presetend (via --internal-testing-template)
183-
if (!isReactInstalled(appPackage) || template) {
193+
if (!isReactInstalled(appPackage) || template || rerunYarn) {
184194
console.log(`Installing react and react-dom using ${command}...`);
185195
console.log();
186196

0 commit comments

Comments
 (0)