Globhy
AllBusinessHealthMarketingTechnologyTravelUncategorized
HAHartanto3 views
Posted on 03 Sep 2026Edited on 03 Sep 2026

Share:

How to Fix "Cannot Find Module or Type Declarations for Side-Effect Import" in TypeScript

How to Fix "Cannot Find Module or Type Declarations for Side-Effect Import" in TypeScript

Learn how to fix the TypeScript TS2882 error for CSS imports, understand noUncheckedSideEffectImports, and use declare module '*.css' in Next.js.

The error:

javascript
Cannot find module or type declarations for side-effect import

doesn't necessarily mean your CSS file is missing.

When importing a stylesheet such as:

javascript
import 'mapbox-gl/dist/mapbox-gl.css'

TypeScript may complain because it doesn't have a declaration describing CSS modules.

This can become more visible when noUncheckedSideEffectImports is enabled.

For most Next.js and React applications, the simplest solution is to create a global declaration:

javascript
// global.d.ts
declare module '*.css' {}

Then make sure global.d.ts is included in your tsconfig.json and restart the TypeScript server.

The key idea is:

TypeScript needs a declaration for the CSS module, while your bundler is responsible for resolving and processing the actual CSS file.

Share:

More in Technology

View category
MT5 clone solution for forex broker and trading companies
Technology
1

MT5 clone solution for forex broker and trading companies

Explore how MT5 Clone Script solutions help forex brokers and trading firms build customizable trading platforms with advanced charts, order management, automation, liquidity integration, and security controls. Learn which features and technologies matter when planning a reliable trading platform for long-term growth.

READ ARTICLE