Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

206
Visualizações
Adding a global type file for css modules links to the type file not the css file, in VSCode

I'm following the advice here on preventing the typescript error 'Cannot find module path/to/style.css' on my CSS Module imports (i.e. import styles from 'path/to/style.css') by creating a Global.d.ts file.

But now when I click on the styles variable, it opens up the global type file.

The same thing happens for 'svg' files.

jsconfig.json

{
 "exclude": ["dist", "node_modules"],
 "compilerOptions": {
   "jsx": "react",
   "checkJs": true,
   "experimentalDecorators": true,
   "baseUrl": ".",
   "paths": {
     "path/*": ["./src/my/path/*"],
   }
 }
}

webpack.config.js

{
  test: /\.css$/,
  use: [MiniCssExtractPlugin.loader,
    {
      loader: "css-loader",
      options: {
        modules: true,
        importLoaders: 1,
        localIdentName: "[name]",
      }
    }
  ]
},

I am hoping for a solution that a) removes the erroneous error and b) works with any file ending (e.g. .svg as well.)

about 4 years ago · Santiago Trujillo
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda