Search code examples
sasswebpackflowtypecss-modules

Flow module not found with .scss file


I have a file using scss with css-modules like so:

import styles from './Login.scss';

The webpack build works fine but i'm getting a flow error: Required Module Not Found

In my .flowconfig I have

[ignore]
.*/node_modules/fbjs/.*
.*/app/main.js
.*/app/dist/.*
.*/release/.*
.*/git/.*

[include]

[libs]

[options]
esproposal.class_static_fields=enable
esproposal.class_instance_fields=enable
esproposal.export_star_as=enable
module.name_mapper.extension='css' -> '<PROJECT_ROOT>/flow/CSSModule.js.flow'
module.name_mapper.extension='styl' -> '<PROJECT_ROOT>/flow/CSSModule.js.flow'
module.name_mapper.extension='png' -> '<PROJECT_ROOT>/flow/WebpackAsset.js.flow'
module.name_mapper.extension='jpg' -> '<PROJECT_ROOT>/flow/WebpackAsset.js.flow'
suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue

I've also seen https://github.com/facebook/flow/issues/338 but it doesn't really have any solution.

Has anyone found a workaround for this issue?


Solution

  • This error can be fixed by assigning .scss files to an empty module. I just npm installed empty and added this to the .flowconfig : module.name_mapper.extension='scss' -> 'empty/object'