-
Notifications
You must be signed in to change notification settings - Fork 357
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
Issues encountered when using a third-party Sass JSON importer #2465
Comments
It's hard to tell whether or not this is the expected behavior without seeing it in action. Can you provide a minimal reproduction that just uses the Sass API, without Vite? |
Thank you for your reply! I created a reproduction for this issue: CodeSandbox Link. You can test it by running the following commands: pnpm install && pnpm dev This will start Vite and reproduce the problem I described within the Vite environment. At the same time, the
indicating that it successfully produces the expected result. However, the issue arises on the Vite side, where I get the following error:
It seems like the issue is more related to Vite rather than Sass itself. Do you think I should report this as an issue to Vite instead? Thank you again for your guidance! 🙏 |
If it's not possible to reproduce this without Vite, then it's likely to be an issue with Vite itself and I suggest you report it there. |
Got it, thank you for your reply. I will report this issue to Vite instead. |
I tried out Sass's new JS API. Since my project requires converting JSON into Sass variables, I originally used the
node-sass-json-importer
package to accomplish this. Here's an excerpt from my Vite configuration:I switched to using @blakedarlin/sass-json-importer as an alternative, but I encountered some issues. Here's the updated Vite configuration:
I am using sass-embedded, but I guess the same issue would occur with sass.
The issue is that if I print the URL in the
canonicalize
method of@blakedarlin/sass-json-importer
, I find that the URL is always@BBB/assets/scss/utils
. This happens becauseutils/index.scss
is not a JSON file, so thecanonicalize
method returnsnull
. However, oncecanonicalize
returnsnull
, other SCSS files that are@use
d,@forward
ed, or@import
ed withinutils/index.scss
no longer go through this importer and instead only pass through the default importer. As a result, my JSON files end up being handled by the default importer instead of @blakedarlin/sass-json-importer, which prevents them from functioning as expected.I would like to ask the following questions:
Thank you so much for your time and assistance! I really appreciate your help. 🙏
The text was updated successfully, but these errors were encountered: