Closed
Description
Is this a bug report?
yes.
It's a project with flow annotations. Lines like these appear to trigger the issue:
import type { Props, ComponentState } from './MyComponent.type'
The error is:
Failed to compile.
./src/components/MyComponent.js
Module build failed: TypeError: Cannot read property 'type' of undefined
at Array.forEach (<anonymous>)
at Array.forEach (<anonymous>)
Moving the code outside the monorepo and yarn; yarn start
: works.
Keep it inside and remove all flow annotations: works.
Did you try recovering your dependencies?
Yes.
In fact, adding a package.json
declaration of
"nohoist": [
"**/react-scripts", "**/react-scripts/**"
]
works around the issue.
Which terms did you search for in User Guide?
flow, monorepo, workspaces
Environment
Environment:
OS: macOS High Sierra 10.13.4
Node: 8.9.1
Yarn: 1.6.0
npm: 6.0.1
Watchman: 4.9.0
Xcode: Xcode 9.3.1 Build version 9E501
Android Studio: Not Found
Packages: (wanted => installed)
(paste the output of the command here)
Steps to Reproduce
- Create a CRA project from scratch
- Add flow annotations as above
yarn; yarn start
- See it working
- Move the code into an existing monorepo with yarn workspaces enabled
yarn; yarn start
- See it failing
Expected Behavior
Should just work.
Actual Behavior
Compilation failure per above error.