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(hmr): load the correct URL for virtual modules #10313

Closed
wants to merge 2 commits into from

Conversation

Akryum
Copy link
Contributor

@Akryum Akryum commented Oct 2, 2022

Description

Currently the HMR client doesn't understand virtual module and tries to load them as /<moduleId>, but they should be loaded as /@id/__x00__<moduleId>.

image

Actual:
image

Causing HMR errors:
image

Expected:
image

Additional context


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.

@patak-dev
Copy link
Member

Thanks for the PR @Akryum, we should go with #10324 so the client only sees URLs in the browser URL space (without \0 and wrapped with /@id/ when needed).

@patak-dev patak-dev closed this Oct 3, 2022
@Akryum Akryum deleted the patch-1 branch October 3, 2022 09:29
@Akryum
Copy link
Contributor Author

Akryum commented Feb 10, 2023

@patak-dev This issue is still present in vite 4.1.0

If I switch to \0 here https://github.com/histoire-dev/histoire/blob/c161d15e2d1fb03e5f865d33a18f82336b9f8e45/packages/histoire/src/node/virtual/index.ts HMR of the virtual files will stop working

@patak-dev
Copy link
Member

Let's reopen the PR to track this. If you find a smaller repro, lets us know @Akryum

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants