You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using Webpack and Sass to implement a Blueprint.js installation. I (and some others, here) are experiencing an issue registering a custom Sass function.
The error makes it seem like the API for registering a custom Sass function has changed out from under us. Like, in the small example of a power function below, if you play with it, you'll see that suddenly the custom Sass function is getting two arguments when there's supposed to be just one. And when you take webpack out of the picture, sure enough, the pow function only gets one argument and everything works just fine.
I pride myself on figuring out these weird front-end issues, but so far I'm stumped. I'm pretty sure this has to be a bug in sass-loader. I believe everything in the reproducible is correct (tell me if not!), and yet the test.scss file does not compile without an error.
In the enclosed reproducible Github project, you'll find a very simple webpack project. It just has an index.js and test.scss file. The test.scss file includes the following:
body {
font-weight: pow(10, 3);
}
pow is a custom function, which was created by copying Sass-lang.org's own custom function example. This custom function was placed into webpack.config as follows:
There are no bugs, you use compileStringAsync in your example, but it is a new sass API and it is tracked here #774, currently we can't use the new API due to lack abilities to implement resolving #774 (comment), yeah, sass team recently merge RFC to support it, so I think it will be fixed soon, but I can't say when, because I am not a part of the sass team and I can't promise anything.
It means we use render currently, you can see when you/we use renderhttps://sass-lang.com/documentation/js-api/interfaces/LegacyStringOptions#functions arguments are not grouping into args and there are no assertNumber or similar functions for other types, sorry, until sass team doesn't finish resolving support we can't use the new API
Bug report
I'm using Webpack and Sass to implement a Blueprint.js installation. I (and some others, here) are experiencing an issue registering a custom Sass function.
The error makes it seem like the API for registering a custom Sass function has changed out from under us. Like, in the small example of a power function below, if you play with it, you'll see that suddenly the custom Sass function is getting two arguments when there's supposed to be just one. And when you take webpack out of the picture, sure enough, the pow function only gets one argument and everything works just fine.
I pride myself on figuring out these weird front-end issues, but so far I'm stumped. I'm pretty sure this has to be a bug in sass-loader. I believe everything in the reproducible is correct (tell me if not!), and yet the test.scss file does not compile without an error.
In the enclosed reproducible Github project, you'll find a very simple webpack project. It just has an
index.js
andtest.scss
file. Thetest.scss
file includes the following:pow
is a custom function, which was created by copying Sass-lang.org's own custom function example. This custom function was placed into webpack.config as follows:I believe I've done everything correct here, but test.scss fails to compile. Details follow.
Actual Behavior
When the dev-server is run...
This error is generated...
Expected Behavior
The project should compile. (And font-weight should be 1000!)
How Do We Reproduce?
I've created a very small github repo here. https://github.com/eastside/webpack-sass-broken
The steps to reproduce this on your own are pretty simple:
npm install webpack webpack-cli webpack-dev-server sass-loader sass
webpack.config.mjs
and contents ofsrc/
node ./node_modules/webpack-dev-server/bin/webpack-dev-server.js
You should see the same error.
Please paste the results of
npx webpack-cli info
here, and mention other relevant informationMacBook-Pro:sass-webpack-test adam$ npx webpack-cli info
System:
OS: macOS 11.6
CPU: (16) x64 Intel(R) Core(TM) i9-9980HK CPU @ 2.40GHz
Memory: 23.53 MB / 32.00 GB
Binaries:
Node: 18.14.1 - /usr/local/bin/node
npm: 9.3.1 - /usr/local/bin/npm
Browsers:
Chrome: 112.0.5615.137
Edge: 112.0.1722.39
Firefox: 102.0.1
Safari: 15.0
Packages:
sass-loader: ^13.2.2 => 13.2.2
webpack: ^5.82.0 => 5.82.0
webpack-cli: ^5.0.2 => 5.0.2
webpack-dev-server: ^4.13.3 => 4.13.3
The text was updated successfully, but these errors were encountered: