Open rjdlee opened 6 years ago
@rjdlee I think it would be helpful to state what version of Create React App you're using, since CRA is supporting Lerna only in their next
version, specifically react-scripts@2.0.0-next.47d2d941
. (https://github.com/facebook/create-react-app/issues/3815). Previous versions don't support Lerna, so that might be the issue.
However, there's still a question if it works in the next
version of CRA. I'll test it out and report once https://github.com/facebook/create-react-app/issues/4154 is fixed.
If you're using the master
version of CRA (1.x), you can try some solutions proposed here https://github.com/facebook/create-react-app/issues/1333, and see if it works.
@rista404 I'll update my CRA and let you know what happens. Thanks.
For all the people subscribed, a PR to fix this has been opened at https://github.com/facebook/flow/pull/6504
Please have a look (and maybe provide feedback)
@steelbrain Looks like that PR isn't gonna be closed... Do you have any other ideas?
I have this kind of configuration :
/packages
package-a/
dist/ // transpiled by babel
src/
index.js
file-a.js
package-b/
dist/
src/
index.js
createReactApp/
src/
index.js
//...
/packages/createReactApp/src/index.js
import packageA from 'package-a';
import fileA from 'package-a/dist/file-a';
/.flowconfig
module.name_mapper='package-a' -> 'package-a/src/index'
module.name_mapper='package-a\/dist/\(.+\)' -> 'package-a/src/\1'
it's working fine.
@flo-pereira do you have one flowconfig
per whole project?
only one flowconfig
at root /.flowconfig
I have a Lerna package containing two different React apps made with Create React App (let's called them App A and App B). One of the apps imports the other one. I want to add Flow support to both apps. To do so, I've installed Flow at the global level.
Flow functions correctly when each app is used separately. However, when I import one of the apps into the other, I get the following error in App B:
The way I interpret this is that Flow is not processing App A because it is a symlinked dependency (due to Lerna) inside App B. To resolve this, here is what I've tried:
module.name_mapper='^app-a$' -> '<PROJECT_ROOT>/../app-a/src/index.js'
whereindex.js
is the entry point for App A. This solution came from: https://github.com/lerna/lerna/issues/891../app-a/src/index.js
flow ls
inside App B and saw that bothapp-b
andapp-a
were part of the file list, but still got the same errorI copy and pasted this from my question on Stack Overflow: https://stackoverflow.com/questions/49090460/using-flow-with-lerna-and-create-react-app#