3

I am trying to import styles from Navbar.module.scss file in my Navbar.tsx component. enter image description here

But it says enter image description here

I have already installed node-sass and @types/node-sass packages. Here's my package.json : enter image description here

2 Answers 2

5

Nevermind, I just installed this package called typed-scss-modules and it generated the type declarations for all the scss files in my src directory.

yarn add -D typed-scss-modules

yarn typed-scss-modules src

Then I imported my scss modules like so:

import styles from './Navbar.modules.scss';

And everything worked so well.

Sign up to request clarification or add additional context in comments.

Comments

0

There is easier way, just add the d.ts file or text to exist file next line

declare module "*.module.scss";

End this should solve the problem.

Comments

Your Answer

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.