-
-
Notifications
You must be signed in to change notification settings - Fork 6.2k
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
Deprecated Sass not allowing modern packaged imports #16602
Comments
Start a new pull request in StackBlitz Codeflow. |
And somehow I missed #14689. It looks like sass-loader (another package, but whatever -- added a top-level option for "modern" (defaulting to legacy) as an overriding option just over 2 years ago (webpack-contrib/sass-loader#774). This allowed them to not break people -- but also support the newer standards through a separate code tree. That's probably a smarter way to handle this. |
@john-easci You can use the Node Package Importer in Vite, using the pkgImporter option- https://sass-lang.com/documentation/js-api/interfaces/legacyfileoptions/#pkgImporter Here's a write-up on how to enable the Node Package Importer in Vite- https://www.oddbird.net/2024/02/22/pkg-importer/#enabling-pkg%3A-urls-in-vite |
@jamesnw Thank you! I had tried using I was able to get it working by adding the appropriate directories to the |
Describe the bug
The system uses
sass.render()
, which has been deprecated for several years now.I found that it was not possible to use the Node.js package importer (https://sass-lang.com/documentation/js-api/classes/nodepackageimporter/) with the current setup.
Additionally, it uses the Sass async renderer for no good reason, and the async renderer is generally twice as slow as the standard one. It was wrapped in a promise anyway, so I don't think there was a good reason for it.
So, this is the code patch, which is in
WorkerWithFallback
... basically replacing everything after creating the _internalImporter (which isn't even used here). I also remove thenode:path
since it is no longer necessary.I get this is a major component, but its currently using a deprecated API and breaks some very valid use cases. Maybe there's a flag for modern handling? Or maybe somebody can point me to where I can patch this functionality without getting into source?
Reproduction
https://stackblitz.com/edit/vitejs-vite-qttc98?file=package.json
Steps to reproduce
I effed around with this StackBlitz for a while but gave up. It looks like it doesn't support github or bitbucket repositories (even public), so I couldn't finalize the simplified test case.
npm run dev.
open site
font should be Times
System Info
Used Package Manager
yarn
Logs
No response
Validations
The text was updated successfully, but these errors were encountered: