-
Notifications
You must be signed in to change notification settings - Fork 91
Description
Hi, I'm wondering if it's possible to support something like vite preview and/or vite build --watch?
I guess the current expectation for checking prod builds is that you would call vite build then collect static and set DJANGO_VITE_DEV_MODE=False before starting the django dev server? Since Vite has the preview command I thought it might be nice to make use of it.
When I tried vite preview, however, the django-vite {% vite_asset 'main.js' %} template tag still served the https://127.0.0.1:3000/static/main.js file instead of something like http://127.0.0.1:3000/static/main.a7ab852f.js which is determined based on the manifest.json file. Of course, the {% vite_hmr_client %} tag also tried to load the HMR client because it's still in dev mode, so maybe this would require an additional config option like DJANGO_VITE_PREVIEW_MODE or something.
Even better would be if we could use vite build --watch and vite preview in combination. The first would create your initial bundle, plus update the build when you make changes, then with vite preview running, if you refreshed the page, it would get the updated bundle files from the preview server. This way you wouldn't have to wait for a complete build to happen each time, call collectstatic, etc. You just save your changes and refresh the page.