Noitidart
Noitidart

Reputation: 37238

Flow - make it treat all imports as .js

In my components, I create a blah.css.js. It's a react-native project.

I then do:

import styles from "blah.css";

The react-native module system correctly recognizes this as "blah.css.js". However Flow is not. It keeps warning me "Required module not found". Screenshot below.

Is there anyway to get Flow to recongize all modules that end with .css as .css.js?

Upvotes: 0

Views: 44

Answers (1)

Pedro Castilho
Pedro Castilho

Reputation: 10512

Add the following line to the [options] section of your .flowconfig:

module.name_mapper='^\(.*\).css$' -> '\1.css.js'

This will make Flow see any module names that finish with .css as finishing with .css.js instead.

Upvotes: 2

Related Questions