Skip to content
This repository has been archived by the owner on Dec 18, 2018. It is now read-only.

Angular 2 : Cannot find module 'sass-variable-loader' #12

Open
pierred69 opened this issue Apr 24, 2017 · 2 comments
Open

Angular 2 : Cannot find module 'sass-variable-loader' #12

pierred69 opened this issue Apr 24, 2017 · 2 comments

Comments

@pierred69
Copy link

pierred69 commented Apr 24, 2017

Hello,

I installed the library using yarn (yarn add sass-variable-loader, then I try to import a sass file, but when I run the app on webpack, I got the message "Cannot find module 'sass-variable-loader'".

I just installed the lib and try to use this import :

import colors from 'sass-variable-loader!style/colors.scss';

The aim is to get the sass variables as js variables into an object.

I followed the main instructions but seems not to be recognized.

Is there something to do in the webpack configuration or something ?
Thx

@christo8989
Copy link

This might be an angular/typescript "issue".
I follow this article to import files other than typescript files.

@dani-coll
Copy link

dani-coll commented May 28, 2018

Try putting two exclamation marks before the loader name like
import colors from '!!sass-variable-loader!style/colors.scss';

It worked for me with npm, angular cli & angular 6, but it still shows a typescript error that cannot find module, which isn't true because it's working, so I ignored it like this

// @ts-ignore
import colors from '!!sass-variable-loader!style/colors.scss';

Another solution is to import it with require

const colors = require('!!sass-variable-loader!style/colors.scss');

Remember to add the package @types/node in this case

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants