Closed JasonJrz closed 2 months ago
Hi @JasonJrz. You don't get HMR nor Hot Reload because you are using pug templates that you redner using express server. That's not a Vite app, so you will not get those benefits. You'd need to use HTML files that Vite is able to render itself and serve through express server thanks to vite-express
.
To sum up, vite-express
nor Vite
will work in a setup that uses express templates. This package is for projects that consist of express backend and Vite frontend and look for a way to join these two separate components together.
You can look at an example app here but it is an SPA and I suspect you are looking for a way to do multipage app. It is possible to do that, you can read about it here.
Please let me know if any of this helps, and in case of any more questions feel free to ask and I'll be happy to answer!
Thanks! @szymmis for the insight, I'll look into the examples, but just to confirm, since I'm using a template engine HMR would not be possible right?
Yes, that's correct. Using template engine is not an use case for vite-express.
Got it, it's not really a big deal, I could probably just use browser-sync to watch the files and trigger the reload if any changes occur, thanks @szymmis
When I make changes inside either my javascript or CSS files, the terminal indicates that HMR occured but when I visit the page, the changes haven't updated and I have to manually reload the page.
Here's my repo: https://github.com/JasonJrz/vite-express