PS: This is the smallest complete SCSS snippet I have simplified for verification purposes. If you need the SCSS code from my project, please let me know.
Actual Behavior
print error:
Bad state: Can't access __parent outside of a module.
Expected Behavior
Generating CSS Output Correctly:
:root {
--text-color: #000;
}
How Do We Reproduce?
You can reproduce it just by importing this SCSS snippet into any Webpack project that uses sass-loader.
Please paste the results of npx webpack-cli info here, and mention other relevant information
Bug report
I get a compilation error when I use the following SCSS code snippet in the project.
In fact, this SCSS snippet runs correctly on the SCSS playground. After the issue, @alexander-akait asked me to come here for help. https://github.com/webpack-contrib/sass-loader/issues/1174#issuecomment-1871167294
https://sass-lang.com/playground/#eJxNjcEKwyAQRO9+xWJ70IPFXPXir0i6JILGEDeQEPLvbZem9DYMb950XVgbgmyxNVeQovRChJK2NAGNWNA02jOqO1caDgHgllqJE0BIU5/XJ8Jn+4jznPeL9W/gFOdPl9MwktLfoTGEG5m+5ro4uFlrPbOX7/+c3QOSYZGSbJJa+xdXFTwC
PS: This is the smallest complete SCSS snippet I have simplified for verification purposes. If you need the SCSS code from my project, please let me know.
Actual Behavior
print error:
Expected Behavior
Generating CSS Output Correctly:
How Do We Reproduce?
You can reproduce it just by importing this SCSS snippet into any Webpack project that uses sass-loader.
Please paste the results of
npx webpack-cli info
here, and mention other relevant informationSystem: OS: macOS 13.4.1 CPU: (8) x64 Intel(R) Core(TM) i5-8259U CPU @ 2.30GHz Memory: 12.07 MB / 8.00 GB Binaries: Node: 18.18.2 - ~/Library/pnpm/node Yarn: 1.22.17 - /usr/local/bin/yarn npm: 8.4.1 - /usr/local/bin/npm Browsers: Chrome: 120.0.6099.129 Edge: 120.0.2210.91 Safari: 16.5.1 Packages: sass: ^1.69.5 => 1.69.5 css-loader: ^6.8.1 => 6.8.1 sass-loader: ^13.3.3 => 13.3.3 style-loader: ^3.3.3 => 3.3.3 webpack: ^5.89.0 => 5.89.0 webpack-cli: ^5.1.4 => 5.1.4