-
-
Notifications
You must be signed in to change notification settings - Fork 6.4k
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
fix: import sass file even if not listed in package.json #3627
Conversation
Co-authored-by: Shinigami <chrissi92@hotmail.de>
Thanks for the PR @roger6106. I tested locally and the new tests are passing even when I remove the fix in this PR. They look good to me but seems that Vite was already working correctly in this case. I don't know what difference the issue has that indeed is fixed by your PR. Could you check if new tests could be added that fails without your fix? |
Sorry about that. I have corrected the test. |
@Shinigami92: Can you take a look at this again? There's not a functional workaround in my situation, and I'm having to hack SvelteKit so that I keep this change functional with it. |
Description
Closes #2499.
Vite currently does not work when using
@material
packages, with no functional workaround. When attempting to load a sass file, the package.json is checked and the main file (which is javascript) is loaded instead of_index.scss
. This change adds an additional check specifically for sass files, making sure that the retrieved extension frompackage.json
matches an existing extension. If not, it falls back to the extension method of determining an index file.Additional context
The
tryResolveFile()
method has atryIndex
parameter, which uses package.json (if it exists), and then falls back to tryingindex
plus extension / prefix. I add an additional optionalskipPackage
parameter which is used when a sass extension doesn't match.What is the purpose of this pull request?
Before submitting the PR, please make sure you do the following
fixes #123
).