-
-
Notifications
You must be signed in to change notification settings - Fork 26.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
flow types fail compilation in monorepo with CRA next.66cc7a90 #4517
Comments
I cannot repro this. Can you provide a clean repo? |
This issue has been automatically marked as stale because it has not had any recent activity. It will be closed in 5 days if no further activity occurs. |
Dear bot, it's still a issue. |
Can you provide a repro? |
I'm facing the same issue with my current mono repo:
If you want to use this repo to reproduce:
I followed https://flow.org/en/docs/tools/create-react-app/. Explaining better this case: |
This should be
|
Thanks @bugzpodder for you answer. I've tried you tip, no luck though. When I tried to run flow, it got stuck. When I try to run the App I also tried some variations of your suggestion, I thought that could be a typo on Don't you think that this could be caused by how babel deals with Monorepos? The changes you suggested was pushed on branch |
Hey, sorry about that. I didn't pay attention to the details of the problem you described. So the issue isn't with flow typed, but it is because create-react-app is not stripping out flow-types from your symlinked node_modules/ when building your app. So this is done on purpose as part of create-react-app configuration. The recommended way is to first run babel on your core module to strip out the flow types and then import it from web. So tooling (yarn workspaces/make) aside, here is what needs to happen:
You maybe able to use a forked version of create-react-app, or otherwise modify the webpack config of react-scripts to achieve 1 - 3. |
Thanks, @bugzpodder this worked great. |
The reason is that create-react-app won't process libraries from using non-standard features such as flow and other js features and proposals that are not currently finalized, in order to avoid defragmentation of the js landscape. |
This issue has been automatically marked as stale because it has not had any recent activity. It will be closed in 5 days if no further activity occurs. |
This issue has been automatically closed because it has not had any recent activity. If you have a question or comment, please open a new issue. |
Is this a bug report?
yes.
It's a project with flow annotations. Lines like these appear to trigger the issue:
The error is:
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 ofworks around the issue.
Which terms did you search for in User Guide?
flow, monorepo, workspaces
Environment
(paste the output of the command here)
Steps to Reproduce
yarn; yarn start
yarn; yarn start
Expected Behavior
Should just work.
Actual Behavior
Compilation failure per above error.
The text was updated successfully, but these errors were encountered: