Flow errors when using react-create-app
See original GitHub issueVersion
1.0.10
Guys love styled-components so thanks! Am on v1.0.10 and still getting flow-type errors. Note I am using create-react-app.
My flow config is as per create-react-app guidelines:
[ignore]
<PROJECT_ROOT>/node_modules/fbjs/.*
Mu deps:
"devDependencies": {
"babel-eslint": "6.1.2",
"eslint": "3.5.0",
"eslint-plugin-flowtype": "2.18.1",
"eslint-plugin-import": "1.12.0",
"eslint-plugin-jsx-a11y": "2.2.2",
"eslint-plugin-react": "5.2.2",
"flow-bin": "^0.34.0",
"react-scripts": "0.7.0"
},
"dependencies": {
"react": "^15.3.2",
"react-dom": "^15.3.2",
"recompose": "^0.20.2",
"styled-components": "^1.0.10"
}
Here are the errors:
node_modules/styled-components/src/models/InlineStyle.js:3
3: import camelizeStyleName from 'fbjs/lib/camelizeStyleName'
^^^^^^^^^^^^^^^^^^^^^^^^^^^^ fbjs/lib/camelizeStyleName. Required module not found
node_modules/styled-components/src/models/InlineStyle.js:5
5: import { StyleSheet } from 'react-native'
^^^^^^^^^^^^^^ react-native. Required module not found
node_modules/styled-components/src/native/index.js:4
4: import reactNative from 'react-native'
^^^^^^^^^^^^^^ react-native. Required module not found
node_modules/styled-components/src/utils/flatten.js:2
2: import hyphenate from 'fbjs/lib/hyphenateStyleName'
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ fbjs/lib/hyphenateStyleName. Required module not found
Issue Analytics
- State:
- Created 7 years ago
- Comments:13 (10 by maintainers)
Top Results From Across the Web
Allow Flow build-time type checking #5995 - GitHub
You can run flow CLI to check for errors as a separate step, just like you do with jest tests. Most editors have...
Read more >Error on type Props in react flow, converting create-react app ...
Flow syntax is not real JS. so things like type Props will fall apart when transpiling or bundling. You need to add a...
Read more >Troubleshooting Guide - React Flow
This guide contains warnings and errors that can occur when using React Flow. We are also adding common questions and pitfalls that we...
Read more >Create React App | Flow
Learn how to use Flow with Create React App. ... All you need to do is install Flow and create a .flowconfig file...
Read more >Static Type Checking - React
Static type checkers like Flow and TypeScript identify certain types of problems before you even run your code. They can also improve developer...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
OK this was not a create-react-app specific issue. I just followed the flow-support docs as recommended by @ryyppy - thanks all 👍
You need to ignore the
styled-components/src
directory, as stated in our flow-support docs…Add following ignore rule in your
.flowconfig
:@mxstbr Is there a reason why
styled-components
needs to deliver thesrc
content in the npm package?