2

I'm only starting learning React and faced an issue while importing styles from './TodoOutput.module.scss':

Error from TodoOutput.tsx:

Cannot find module ./TodoOutput.module.scss or its corresponding type declarations.ts(2307)

even though file TodoOutput.module.scss exists, and both scss and sass packages added into both package.json and package-lock.json

Here is TodoOutput/ directory:

enter image description here

Review package.json

Review package-lock.json

Review tsconfig.json

asked May 9, 2023 at 16:19

2 Answers 2

7

I find the problem. You need to create a Global.d.ts file inside yours src folder and add following lines.

declare module "*.module.css";
declare module "*.module.scss";
answered May 9, 2023 at 18:29
Sign up to request clarification or add additional context in comments.

Comments

0

The import looks ok, but when you set paths in tsconfig you need to add baseUrl for example src.

If this does not help, try renaming the file, maybe you changed the keyboard when naming

answered May 9, 2023 at 16:40

1 Comment

Unfortunately none of the advices helped

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.