问题
Updated to Create React App 2
which supports css modules via the following import statement:
import styles from "./myStyles.module.scss";
However, flow
is complaining saying this:
Importing from an untyped module makes it any and is not safe!
Did you mean to add // @flow to the top of ./myStyles.module.scss? (untyped-import)
This is what the [options]
in my .flowconfig
file looks like:
module.file_ext=.js
module.file_ext=.jsx
module.file_ext=.scss
I've also tried adding the following line:
module.file_ext=.module.scss
回答1:
You probably want to use module.name_mapper.extension to get it to map your SCSS files to some mocked module. (The flowtype docs even have an example for doing this same thing with .css files).
So you might use this config:
module.name_mapper.extension='scss' -> '<PROJECT_ROOT>/SCSSFlowStub.js.flow'
and in SCSSFlowStub.js.flow
export default Object;
来源:https://stackoverflow.com/questions/50053928/scss-modules-giving-flow-error