Share:

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.
- You have only a few CSS imports.
- You want stricter module declarations.
- You want TypeScript to catch more invalid CSS paths.
- You are maintaining a library with carefully controlled imports.
For a typical Next.js application with multiple third-party packages, however, the wildcard approach is generally more convenient.
Recommended Configuration for Next.js
If you're using Next.js and encounter:
TS2882: Cannot find module or type declarations for side-effect importand the problematic import is a CSS file, start with:
global.d.ts
declare module '*.css' {}Then make sure the file is included in your TypeScript project.
For example:
tsconfig.json
{
"include": [
"global.d.ts",
"src/**/*.ts",
"src/**/*.tsx"
]
}Share:
More in Technology
View category
Second Hand Bike: How to Check, Choose & Buy Used Bikes
Buy used bikes online with Vutto. Browse verified second-hand motorcycles from trusted sellers, compare prices, check specifications, and find the perfect pre-owned bike at the best value.

Data Integration Market Transformation Driven by Unified Data Ecosystems
The Data Integration Market size was valued at USD 16.23 Bn in 2025. The Global Data Integration Market is estimated to grow at a CAGR of 11.23% over the forecast period.

ERC-20, ERC-721, or ERC-1155? Choosing the Right Ethereum Token Standard for Your Business
Explore ERC-20, ERC-721, and ERC-1155 for Ethereum token development. Choose the right standard and get 30% off this Halloween with Developcoins.
READ ARTICLE