declare module '*.css' { const content: { [className: string]: string }; export default content; }
08:22 15 Jan 2026

I’m using Next.js with TypeScript, and when importing the global CSS file like this:

import './globals.css';

TypeScript shows an error in the editor (not during runtime):

Cannot find module or type declarations for side-effect import of './globals.css'.

The app runs fine, but the error appears inline in the code and causes TypeScript warnings.

How can I fix this TypeScript error properly?

typescript next.js esmodules