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.
Then restart the TypeScript server.
Your original import can remain unchanged:
import 'mapbox-gl/dist/mapbox-gl.css'You don't need to move the CSS file into your own src directory.
Frequently Asked Questions
Why does TypeScript say it cannot find a CSS file that exists?
Because TypeScript needs to resolve the import through its module/type system. The fact that the CSS file exists on disk doesn't automatically provide TypeScript with a module declaration for it.
Adding:
declare module '*.css' {}tells TypeScript how to treat CSS modules.
Do I need @types/mapbox-gl to fix this error?
Not for the CSS declaration itself.
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