r/webdev•
StillTop

How to rebuild production dist HMR style

I have a typescript app with a Vite-express backend to fetch an html table from a file and display it, Ideally this table needs to be refreshed (sports betting odds) so I also have a program that adds an updated time stamped file to the file-cache and since they are time stamped, my function is returning the one with the most recent time stamp, however in a production build, that file is not being added into the “dist” directory but using dev mode it works fine since it lives in the public folder, should I be accessing a different directory from the project root that doesn’t get put in “dist” which treats it as static files

Posted Jun 8, 2023, 6:10 PM UTC

12
Dull_Nothing_7849•

Have you tried adding the updated file to the 'public' folder instead of the 'dist' directory? That way it should be treated as a static file in production, just like in dev mode. Hope that helps!

1
StillTopOP•

that’s what happens in the development environment, but production takes those files and essentially rebuilds them in “dist” so if a file is added while the server is running in dev, it updates, but production can’t find the file because it wasn’t built. tsc —watch also prevents my backend from starting up so that didn’t work.

1