Skip to content
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: prevent cache on optional package resolve #10812

merged 3 commits into from
Nov 7, 2022


Copy link

@bluwy bluwy commented Nov 7, 2022


When resolving optional packages for Vite, like sass, use the resolve package to resolve first to avoid nodejs caching the result (even if the module is not found).

This allows users to install sass while the Vite server is still running, and it'll pick up the changes without restarting.

Additional context

This is tricky to make a test for, but I've confirmed that it's working in the playground projects manually.

What is the purpose of this pull request?

  • Bug fix
  • New Feature
  • Documentation update
  • Other

Before submitting the PR, please make sure you do the following

  • Read the Contributing Guidelines.
  • Read the Pull Request Guidelines and follow the Commit Convention.
  • Check that there isn't already a PR that solves the problem the same way to avoid creating a duplicate.
  • Provide a description in this PR that addresses what the PR is solving, or reference the issue that it solves (e.g. fixes #123).
  • Ideally, include relevant tests that fail without this PR but pass with it.

@bluwy bluwy added feat: hmr p3-downstream-blocker Blocking the downstream ecosystem to work properly (priority) labels Nov 7, 2022
@bluwy bluwy marked this pull request as draft November 7, 2022 11:52
@bluwy bluwy marked this pull request as ready for review November 7, 2022 13:25
Copy link

@patak-dev patak-dev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting hack! I think we should merge this one now and let people test it a bit. @bluwy did you want to backport this one? We could do it if it proves stable in the v4 alpha

Copy link
Member Author

bluwy commented Nov 8, 2022

Yep! We could probably check ecosystem-ci when this is released and backport it to v3 when it's good. (I think it'll likely be safe though)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
feat: hmr p3-downstream-blocker Blocking the downstream ecosystem to work properly (priority)
None yet

Successfully merging this pull request may close these issues.

None yet

2 participants