question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Css modules are not generating type definitions on buildscripts

See original GitHub issue

The build script does not wait until all .d.ts css type definitions are done being generated before trying to compile, resulting in TS2307: Cannot find module './style.css' or its corresponding type declarations. errors on CI builds.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
rschristiancommented, Nov 25, 2020

I removed the .css.d.ts file generation, which is what allowed TS to build and would also give autocomplete help. It was replaced by a generic message to TS that all CSS files would be fine and a plugin to give autocomplete help. Should work on both IDEs (all IDEs) hopefully.

1reaction
Javicommented, Nov 25, 2020

Oh I thought you had removed the whole thing and it worked. Well so that’s definitely an improvement then, worst case scenario a VSCode user could write a plugin if they absolutely need CSS typings, if any. All people I know who care that much about types go with Webstorm though, so once the PR lands I’d say to close the issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cannot see typing newly generated file (build error) #33
Start webpack in watch dev server mode; Create new css file like ... the type definition files are still missing and the build...
Read more >
Create-react-app + TypeScript + CSS Modules - Stack Overflow
Existing workaround: You can manually create ComponentName.module.css.d.ts files with type definitions like this: export const identifierName: ...
Read more >
Generating TypeScript definitions for CSS Modules using SASS
Tooling and approaches for integrating CSS Modules, SASS, and TypeScript to add additional type-safety when importing the styles.
Read more >
Creating a React Component Library using Rollup, Typescript ...
If you don't want to use Sass, I'll also be showing you how to use CSS Modules, LESS, or Stylus to build your...
Read more >
Frontend library development with vite and tailwindcss
Shows how to develop a library using vite and tailwindcss. We'll show you how to generate ... This will generate a CSS Modules...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found