【问题标题】:Get VsCode IDE support for css modules?获得对 CSS 模块的 VsCode IDE 支持?
【发布时间】:2020-04-06 00:28:39
【问题描述】:

Gatsby 支持开箱即用的 css 模块。但是,VsCode 没有。这导致:

  1. CSS 模块导入缺少类型完成
  2. 因为 VsCode Typescript 编译器找不到 page.module.css,所以 css 模块名称下方出现红线

比如下面代码中没有补全,导入用红色下划线

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

如何让我的 IDE 支持 css 模块?

这与让我的代码编译不同。它已经编译了,因为 Gatsby 支持 css 模块,我只需要我的 IDE 来识别它们。

【问题讨论】:

    标签: visual-studio-code css-modules


    【解决方案1】:

    你试过const styles = require('./componentName.module.css');

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2017-04-22
      • 1970-01-01
      • 2015-12-05
      • 1970-01-01
      • 2012-03-12
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多