CSS Compilation Issue
See original GitHub issueUsing a default Laravel installation and importing the SCSS stylesheet, Sweet Alert is unable to compile due to the following error.
import Swal from ‘sweetalert2/dist/sweetalert2.js’ import ‘sweetalert2/src/sweetalert2.scss’
warn - You have enabled the JIT engine which is currently in preview.
ERROR in ./node_modules/sweetalert2/src/sweetalert2.scss (./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[7].oneOf[1].use[1]!./node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[7].oneOf[1].use[2]!./node_modules/sass-loader/dist/cjs.js??ruleSet[1].rules[7].oneOf[1].use[3]!./node_modules/sweetalert2/src/sweetalert2.scss)
Module build failed (from ./node_modules/sass-loader/dist/cjs.js):
SassError: Undefined function.
╷
517 │ $icon-zoom: math.div(strip-units($swal2-icon-size), 5);
│ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
╵
node_modules\sweetalert2\src\scss\_core.scss 517:13 @import
node_modules\sweetalert2\src\scss\_theming.scss 8:9 @import
node_modules\sweetalert2\src\sweetalert2.scss 4:9 root stylesheet
Issue Analytics
- State:
- Created 2 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
How to fix compiling problems with .css file - Stack Overflow
css file but I ran into some compilation issues. I'm not as familiar with .css so it was hard for me to fix...
Read more >CSS Compile Error - Material Design for Bootstrap
Hello, I am trying to set the order of SCSS files in my main SCSS file. I'd like to compile in the following...
Read more >Sass compilation error - HTML-CSS - The freeCodeCamp Forum
I try to compile my sass code to css using the command: “npm run compile_sass” but keeps getting this error message below:
Read more >CSS compilation issue when $enable-rounded: true #1508
When $enable-rounded is set to true , CSS compilation fails: ╷ 1875 │ $carousel-indicator-active-radius: 0 100% 100% 0 / ...
Read more >Webpack and Bulma CSS compilation Error - Laracasts
Webpack and Bulma CSS compilation Error. Hey,. Following is my package.json. Copy Code "devDependencies": { "axios": "^0.15.2", "bootstrap-sass": "^3.3.7", ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Ok, looks like this is happening because the
math.div
function used is available with the Dart Sass compiler but not with the LibSass compiler… See https://sass-lang.com/documentation/modules/math#divSweetalert2’s own build system uses the Dart Sass package.
We know (based on the error above) that Laravel is using sass-loader. The docs for that package say it can use either Node Sass (which uses LibSass) or Dart Sass, and I’m guessing your default Laravel installation is set up with Node Sass.
@tomshaw You could see about changing the Laravel installation to use the Dart Sass package instead of Node Sass.
It’s included.