Open arnriu opened 2 months ago
I tested locally with a standalone setup without vite, both new API and legacy API worked just fine. This seems to be issue only when compiling via vite as pointed out by this comment: https://github.com/twbs/bootstrap/issues/39978#issuecomment-2173495103
sass-embedded
's emulated legacy API is indeed not fully compatible with sass
in some corner cases. We can potentially look into what's the difference and try to fix it. However, at this point it would be much better for vite team to switch to the new API instead: https://github.com/vitejs/vite/issues/7116
Can you provide a minimal reproduction of this that doesn't involve a bunch of external dependencies?
Sure. Here it is without react, only vite + sass-embedded + bootstrap.
As a reminder:
src/index.sass
if you comment out @import bootstrap/scss/variables
it will work. But if you let it, it will throw an error.variables
it is the last line @import causing the problem. I didn't dig more."sass": "npm:sass-embedded@1.77.1",
to "sass": "npm:1.77.1",
in package.json
, run npm install
and try again, it will work well as well. Problem only exists with sass-embedded.https://codesandbox.io/p/devbox/competent-mahavira-forked-3jh7fj?file=%2Fpackage.json
I'm looking for a reproduction without vite as well—for all we know, this is a bug in Vite's custom importer.
Since bootstrap 5.3.3, sass-embedded throw an error. The problem was not present with bootstrap 5.3.2 and earlier, and is not present with normal sass package.
Here is the link to the open issue in bootstrap repo, with a reduced test case in a reproducible environment: https://github.com/twbs/bootstrap/issues/39978#issue-2292514748
More specifically, the problem seems to be this line. If we remove it, everything runs fine: https://github.com/twbs/bootstrap/blob/d2d4581790da2618d3fe063dafaa6205c73aabdd/scss/_variables.scss#L1751