Dart sass supports the new modules system, and when it encounters @import "X" should prefer X.import.scss to X.scss.
We are using this to maintain support for users of our library who may not have moved to dart sass yet, or may be using an old version, by creating X.import.scss files in parallel to X.scss files and using new sass features only in the X.import.scss files. So, for example, we have some functions in an X.scss file that use / for division, and the X.import.scss file replaces the / with math.div, which wouldn't work for node-sass users while the / would cause deprecation warnings for dart sass users. This is along the lines of what Natalie describes here: https://github.com/patternfly/patternfly/issues/4096#issuecomment-859055362
When I compile our scss with sass directly, we get no deprecation warnings, because wherever we have these X.import.scss files they are being preferred to the old X.scss files. However, when I build our scss into a Webpack 5 bundle, we get a whole slew of deprecation warnings. It looks like the X.scss files are being used and the X.import.scss file ignored.
Does fast-sass-loader support this behaviour of dart sass, to prefer X.import.scss to X.scss? If not, this is a request for that feature please. If it does, maybe I've done something wrong to break this in my Webpack build -- any ideas as to what I might have done would be gratefully received!
btw, here is the Webpack config we're using. It's inside storybook, just to make things more complicated:
We're using webpack 5.57.1, and fast-sass-loader 2.0.0 with sass 1.42.1.
Dart sass supports the new modules system, and when it encounters
@import "X"
should preferX.import.scss
toX.scss
.We are using this to maintain support for users of our library who may not have moved to dart sass yet, or may be using an old version, by creating
X.import.scss
files in parallel toX.scss
files and using new sass features only in theX.import.scss
files. So, for example, we have some functions in anX.scss
file that use / for division, and theX.import.scss
file replaces the / with math.div, which wouldn't work for node-sass users while the / would cause deprecation warnings for dart sass users. This is along the lines of what Natalie describes here: https://github.com/patternfly/patternfly/issues/4096#issuecomment-859055362When I compile our scss with sass directly, we get no deprecation warnings, because wherever we have these
X.import.scss
files they are being preferred to the oldX.scss
files. However, when I build our scss into a Webpack 5 bundle, we get a whole slew of deprecation warnings. It looks like theX.scss
files are being used and theX.import.scss
file ignored.Does fast-sass-loader support this behaviour of dart sass, to prefer
X.import.scss
toX.scss
? If not, this is a request for that feature please. If it does, maybe I've done something wrong to break this in my Webpack build -- any ideas as to what I might have done would be gratefully received!