已更新为 Create React App 2
,它通过以下导入语句支持 css 模块:
import styles from "./myStyles.module.scss";
但是,flow
提示说:
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)
这是我的 .flowconfig
文件中的 [options]
的样子:
module.file_ext=.js
module.file_ext=.jsx
module.file_ext=.scss
我还尝试添加以下行:
module.file_ext=.module.scss
最佳答案
您可能想使用 module.name_mapper.extension
让它将您的 SCSS 文件映射到某个模拟模块。 (flowtype 文档甚至有一个用 .css 文件做同样事情的例子)。
所以你可以使用这个配置:
module.name_mapper.extension='scss' -> '<PROJECT_ROOT>/SCSSFlowStub.js.flow'
在 SCSSFlowStub.js.flow 中
export default Object;
关于css - SCSS 模块给出流错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50053928/