My project structure:
webpack.config.js
app--
--> src
---->> components
------>>> myComponent.js
------>>> myComponent.scss
--> styles
---->> variables.scss
In webpack.config module.exports:
...
resolve: {
alias: {
styles: path.join(__dirname, 'app/styles')
}
}
In my file - myComponent.scss:
@import "styles/variables";
I am getting this error when building bundle.js:
Module build failed:
@import "styles/variables";
^
File to import not found or unreadable: styles/variables
How can I @import aliases in sass files?
styles
is included both inalias.styles
aspath.join(..., 'app/styles')
and in the import as@import "styles/variables"
. It may need to be@import "variables"
. – Intuitivism