简体   繁体   中英

Get VsCode IDE support for css modules?

Gatsby supports css modules out of the box. However, VsCode does not. This results in:

  1. lack of type completion for CSS module imports
  2. A red line underneath the css module name because the VsCode Typescript compiler cannot find page.module.css

For example, there is no completion in the following code and the import is underlined in red

import styles from './componentName.module.css'

How do I get my IDE to support css modules?

This is different from getting my code to compile. It already compiles because Gatsby supports css modules, I just need my IDE to recognize them.

Have you tried const styles = require('./componentName.module.css');

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM