-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fallback to sass if sass-embedded fails #19518
Comments
@wesnm Sadly, NPM is a bit nuts and configuring optional dependencies to be omitted and then doing Fair note of warning: |
In my specific case, these are all second-level dependencies coming in from another package (Quasar). It calls out The existence of these two |
Yes. It's possible, but not dynamically in the sense of at the level of the dependent package. See also npm/rfcs#120 which was meant to tackle this problem. |
Describe the bug
The
loadSassPackage()
function loadssass-embedded
without validating that the module is functional and falling back to thesass
package where possible (with a warning or something). Thesass-embedded
package seems to install on any system, regardless of the availability of the needed Dartsass
binary. So the import succeeds inloadSassPackage()
but will later fail when the pre-processor is actually used.Quasar installs sass-embedded as a dependency. Vite will try to use the package, but the build will fail with
[vite:css] [sass] Embedded Dart Sass couldn't find the embedded compiler executable. Please make sure the optional dependency sass-embedded-freebsd-x64 is installed in node_modules
. Of course that package does not exist (and likely never will).Installing
sass
and then manually removingsass-embedded
from package-lock and node_modules allows project to build. There might be a more elegant way to do it with overrides, but ideally Vite would be able to test/detect thatsass-embedded
does not work on the platform and fall back tosass
before failing.This isn't really FreeBSD-specific; ideally Vite would fall back to
sass
if the architecture-specificsass-embedded-<arch>
isn't available.Reproduction
https://sorry.dont.have.one
Steps to reproduce
How to replicate (with Quasar because it will preprocess sass by default):
pkg install npm
npm init quasar@latest
npx quasar build
in the project directory, will fail looking forsass-embedded-freebsd-x64
npm i sass
,npx quasar build
, still failsnpx quasar build
, should succeed.System Info
Used Package Manager
npm
Logs
Debug log of build output:
Validations
The text was updated successfully, but these errors were encountered: