-
Notifications
You must be signed in to change notification settings - Fork 24
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
vite auto-refresh #66
base: main
Are you sure you want to change the base?
Conversation
Thanks for the PR! I wonder, does Vite not like the template approach? Maybe we should restructure the examples to have better support by Vite? Right now it feels like we replaced a stable working dev setup with a fast but brittle solution. Don't get me wrong, I like the speediness of Vite but with Webpack everything just worked without any special setups. Unfortunately, I don't have much experience with Vite but I'll poke around a little tonight. |
Yeah this is the primary "issue". Vite out of the box assumes 1:1 mapping of files on disk to your app entry points. Plugins can help with some of this, but plugin ecosystem is young.
I thought about this as well, but the issue is that we really do want a template of some type for the
Have a look at my latest changes and let me know what you think. I don't mind reverting if that is your preference! |
@@ -28,6 +28,7 @@ | |||
"prerelease": "rm -rf dist/*; npm run build; zip -r dist.zip dist", | |||
"pretest": "npm run lint", | |||
"start": "vite", | |||
"preview": "vite preview", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
vite build && vite preview
lets you view a production version of the site locally.
Hmm really odd error in the CI. I tried to track I down earlier to no avail.. |
Normally vite handles a request for
index.html
, butvite-plugin-virtual-html-template
intercepts requests for.html
and doesn't allow vite to inject a runtime client to handle auto-refreshing.This PR adds a minimal plugin to inject the
/@vite/client
code during dev and force and auto-refresh. It's not perfect, but it's better than the existing solution.