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 reports "Required module not found" when requiring a .scss file via Webpack #338
Comments
I believe this is a duplicate of #51? |
Indeed, thanks. But still, are there any work-arounds for the issue ? |
@gcazaciuc Did you ever find a solution to this? I'm using and getting an error. However, for another (regular css file) it works fine: |
you just need to make sure that the module.name_mapper setting in flowconfig contains mappings for scss file extension and is mapping it to a dummy module. |
Hi, |
@marianna-exelate You can find the documentation about that here: https://flowtype.org/docs/advanced-configuration.html#options It's basically telling flow to treat such imports (like SCSS files) as another import which flow can actually understand. "Dummy module" just means that that module does not actually do anything besides being there to please flow. |
- Demo a very simple example of Flow usage in RoomLabel/index.js - Modify ESLint config to play nice with Flow. See: https://github.com/gajus/eslint-plugin-flowtype and http://stackoverflow.com/questions/36258234/eslint-with-arbnb-config-and-facebook-flow-together - Trick Flow into playing nice with scss module imports. See: facebook/flow#338
in
|
@rofrol your solution kills the flow type checking in all *.js, *.jsx files, it should be:
Link for docs |
patrykkarny is totally right, it took a while before I discovered that the solution ignores all js type checks |
For those looking for documentation, a lot of the above links are either broken or the pages have been updated. This page currently has information on the module.name_mapper option. |
added all the file types I wanted flow to recognize: in .flowconfig file
|
@patrykkarny thanks, it works — that setting stops flow from showing errors on import of scss files — but now is displays tons of error directly in scss-files, like this:
Looks like flow tries to import these files content as is – but webpack is configured to load them es ES modules |
Hi, I have the same problem... Could you fix this ? |
I am facing the same issue (no error is import scss files, but errors occurs inside the actual scss file). Could you please share the solution if you found one? Thanks. |
try this #338 (comment) |
Using Webpack for build management and an example file like:
require('../css/seed-component.scss');
var React = require('react');
var SeedComponent = React.createClass({
getInitialState: function() {
return { 'data' : 'Seed Component' };
},
render: function(): ?ReactElement {
return (
Header for Seed component
{this.state.data}
Component props
{this.props.name}
);
}
});
When running Flow over it it complains about the line "require('../css/seed-component.scss');" throwing an error "Required module not found" . I believe Flow should check that it's dealing with a JS file before throwing this error since in webpack it is common to require css files and images.
Currently this is a showstopper for me on using Flow and Webpack on a large project. Any suggested work-arounds ?
Thanks!
The text was updated successfully, but these errors were encountered: