File tree 1 file changed +11
-1
lines changed
packages/react-scripts/scripts
1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -23,6 +23,7 @@ const { defaultBrowsers } = require('react-dev-utils/browsersHelper');
23
23
const os = require ( 'os' ) ;
24
24
const resolveFrom = require ( 'resolve-from' ) ;
25
25
const paths = require ( '../config/paths' ) ;
26
+ const { findMonorepo } = require ( 'react-dev-utils/workspaceUtils' ) ;
26
27
27
28
function isInGitRepository ( ) {
28
29
try {
@@ -177,10 +178,19 @@ module.exports = function(
177
178
fs . unlinkSync ( templateDependenciesPath ) ;
178
179
}
179
180
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
+
180
190
// Install react and react-dom for backward compatibility with old CRA cli
181
191
// which doesn't install react and react-dom along with react-scripts
182
192
// or template is presetend (via --internal-testing-template)
183
- if ( ! isReactInstalled ( appPackage ) || template ) {
193
+ if ( ! isReactInstalled ( appPackage ) || template || rerunYarn ) {
184
194
console . log ( `Installing react and react-dom using ${ command } ...` ) ;
185
195
console . log ( ) ;
186
196
You can’t perform that action at this time.
0 commit comments