Owaiz Yusufi
Owaiz Yusufi

Reputation: 916

React with SASS - How to work with SASS in React

So, the basic usage of SASS in react is

Install node-sass and import ./mysass.scss in index.js file

I did the same it worked with bootstrap SASS.

I have successfully imported bootstrap.scss in index.js file

import 'bootstrap/scss/bootstrap.scss';

But, now if I try to import mine it did not work.

Let me give you some information about my SASS files.

Does this @use create the problem?

I have checked the bootstrap.scss file and they are using @import.

Upvotes: 2

Views: 1876

Answers (1)

Abin Thaha
Abin Thaha

Reputation: 4643

See this issue on Github: Link. Solution posted by user asyncLiz.

That error is typically seen when using the node-sass implementation, which does not support Sass modules and is not supported by MDC. You'll need to use the Dart sass implementation.

Luckily it's an easy replacement when using sass-loader. Run npm uninstall node-sass && npm install sass. sass-loader will automatically use the new implementation.

If it does not, check your webpack.config.js in case you're manually specifying the implementation in your sass-loader options. If you are, change implementation: require('node-sass') to implementation: require('sass').

Upvotes: 2

Related Questions