dart-sass icon indicating copy to clipboard operation
dart-sass copied to clipboard

Variables from an imported, forwarded module are not passed through as configuration to another imported, forwarded module

Open jathak opened this issue 3 months ago • 1 comments

Given code like:

<==> entrypoint.scss
@import 'def_wrapper';
@import 'ref_wrapper';

<==> _def_wrapper.scss
@forward 'def';

<==> _def.scss
$variable: blue;

<==> _ref_wrapper.scss
@forward 'ref';

<==> _ref.scss
$variable: red !default;

a {
  b: $variable;
}

You would expect the $variable: blue definition to be passed through the _ref.scss as implicit configuration, but that doesn't currently seem to be the case (the above code emits a { b: red; }).

jathak avatar Sep 05 '25 20:09 jathak

It looks like #2642 didn't fix this when nested imports are involved, e.g. if entrypoint.scss in the above example were instead

a {
  @import 'def_wrapper';
  @import 'ref_wrapper';
}

the output still uses the $variable: red definition instead of blue. It correctly uses blue when only the ref_wrapper import is nested, so I'm guessing this is an issue with implicit configurations being properly created from local scopes.

jathak avatar Oct 09 '25 00:10 jathak