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): base default protocol on client source location #11497

Merged
merged 1 commit into from
Jan 4, 2023

Conversation

geigerzaehler
Copy link
Contributor

Description

Derive the default HMR protocol on the location where client.ts is imported from instead of window.location. Now, HMR works out of the box if the page is served over HTTPS while the Vite serves its files over HTTP.

This PR is missing a test. I’d be happy to add one if someone points me to the right place for this.


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 PR Title 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.

Derive the default HMR protocol on the location where `client.ts` is
imported from instead of `window.location`. Now, HMR works out of the
box if the page is served over HTTPS while the Vite serves it files over
HTTP.
@bluwy bluwy added feat: hmr p3-minor-bug An edge case that only affects very specific usage (priority) labels Dec 28, 2022
Copy link
Member

@sapphi-red sapphi-red left a comment

Choose a reason for hiding this comment

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

Thanks!

We have setup related tests here.
I guess simply removing these lines would work.
https://github.com/sapphi-red/vite-setup-catalogue/blob/abde225a7bcdd608370343dc218f5d92a7145fe7/tests/fixtures/backend-https-vite-http/vite.config.js#L10-L12
Just in case, the tests won't pass if you didn't link the local Vite.

@bluwy
Copy link
Member

bluwy commented Jan 2, 2023

/ecosystem-ci run

@vite-ecosystem-ci
Copy link

vite-ecosystem-ci bot commented Jan 2, 2023

📝 Ran ecosystem CI: Open

suite result
astro ✅ success
histoire ✅ success
iles ✅ success
ladle ✅ success
laravel ✅ success
marko ✅ success
nuxt-framework ✅ success
previewjs ✅ success
qwik ✅ success
rakkas ✅ success
sveltekit ✅ success
vite-plugin-ssr ✅ success
vite-plugin-react ✅ success
vite-plugin-react-pages ✅ success
vite-plugin-react-swc ✅ success
vite-plugin-svelte ✅ success
vite-plugin-vue ✅ success
vite-setup-catalogue ✅ success
vitepress ✅ success
vitest ✅ success
windicss ✅ success

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feat: hmr p3-minor-bug An edge case that only affects very specific usage (priority)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants