Go Back
CSSModuleClasses not defined?
Posted:
Last modified:
When transpiling our component library with a NextJS project I ran into an error where the NextJS project didn’t know about the type CSSModuleClasses.
Turns out this is a global type that Vite provides. Because NextJS is using its own compiler and defines the CSS modules differently, TypeScript would complain that it didn’t know about CSSModuleClasses.
The solution was to define CSSModuleClasses in our component library and use that instead of the global Vite type.
There is a possibility that our locally defined CSSModuleClasses will become out of sync with the Vite or NextJS definition, but given how this type works it’s unlikely that they will be changing that definition.