Next.js Discord

Discord Forum

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

Answered
Rex posted this in #help-forum
Open in Discord
RexOP
On a old project I am working on I have this issue. Thinking it might be my project I created a new one from scratch, but this error still persists
Answered by Greater Shearwater
In my case it was VS code using TS version 6. Assuming your project uses a production version of TS, which will be 5.x.x, you shouldn't see any errors if you ran npx tsc --noEmit. So it's just VS code using a different version.

At the bottom right side in VS code you can hover over "TypeScript" (when you are in a .ts or .tsx file) and change the version to "Use Workspace Version" from there.
View full answer

2 Replies

Greater Shearwater
In my case it was VS code using TS version 6. Assuming your project uses a production version of TS, which will be 5.x.x, you shouldn't see any errors if you ran npx tsc --noEmit. So it's just VS code using a different version.

At the bottom right side in VS code you can hover over "TypeScript" (when you are in a .ts or .tsx file) and change the version to "Use Workspace Version" from there.
Answer