I need to use Sass math.div function in my angular application. Here is the example of my SCSS code:
@use "sass:math";
div {
min-height: math.div(100, 2);
}
I created the angular application using ng new my-application command. Also I created a library in the application using ng generate library my-lib command.
The SCSS code with math.div works fine in the library. If I put the SCSS code in projects/my-lib/src/lib/my-lib.component.scss and run ng build my-lib then the library will build successfully.
But if I put the SCSS code in src folder, for example src/app/app.component.scss and run command ng build then I get this error:
Error: Module build failed (from ./node_modules/sass-loader/dist/cjs.js):
SassError: Undefined function.
╷
4 │ min-height: math.div(100, 2);
│ ^^^^^^^^^^^^^^^^
╵
src\app\app.component.scss 4:17 root stylesheet
math.div function is available in sass since 1.33.0, so I think the problem is that angular app has different sass version from angular lib for some reason. But I don't know how to fix it.
For example min-height: math.pow(10, 2); works fine in the app. math.pow is available since 1.25.0