Cannot find module or type declarations for side-effect import of './globals.css'
Answered
Rex posted this in #help-forum
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
At the bottom right side in VS code you can hover over "TypeScript" (when you are in a
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.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
At the bottom right side in VS code you can hover over "TypeScript" (when you are in a
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