I'm using PhpStorm 2018.2 for an Angular project (build with Webpack 4.16)
I set up aliases within webpack to import scss files like this:
resolve: {
alias: {
'styles': `${helpers.root('src/styles/')}`
},
}
In my scss files, I can do import like this:
@import '~styles/variables';
From a webpack point of vue, it is working great. But PhpSotrm is giving me an error:
Is this a missing feature in PhpStorm (I can see clearly here that this should be working for Webstorm)
This question describe the problem on webstorm but I could not find any explanation for PhpStorm.
So am I doing things wrong or is it a bug in PhpStorm ?
EDIT following Ru's answer:
1 If I change webpack.config.js to
resolve: {
alias: {
'#styles': `${helpers.root('src/styles/')}`
},
}
and the code in a scss file to:
@import '#styles/_variables';
The errors is to be gone form phpStorm but webpack raise an error:
@import '#styles/_variables';
^
File to import not found or unreadable: #styles/_variables.
2) If I use another symbol (I tried @
and $
and %
and &
) or no symbol, webpack raise an error and phpStorm raise an error...
3) If I use ~
, it doesn't use the webpack alias (I removed the webpack alias and it works), so there is clearly something I don't get here.
Why does webpack manage to find my variables.scss located within /src/styles folder when there is no alias defined in webpack....