A proof-of-concept integration of Vite.js (modern JS/assets bundler) with Phoenix + Liveview

IIRC, the publicDir: "./static config, copies everything from assets/static to priv/static. So there should be no problem in deleting those files in development. Make sure you are not mixing approaches like the one used with the new esbuild (where everything is put directly into priv/static).

What do you mean exactly? By changing that config above files are copied but the directory is not erased. For sure you could also move those files but I don’t see much of a difference of both solutions.

The emptyOutDir config empties the priv/static directory, which is the default behavior you get from Vite to make things easier to check while in development. But here we have to configure it manually to do that.

You mentioned that your robots.txt file was being deleted from priv/static, but you are not supposed to keep the original files there. Using the config I provided, everything from assets/static is copied over to priv/static (both files and directories). So, if you want to keep your robots.txt file, it should be placed inside assets/static - like we used to do before esbuild.

The emptyOutDir config defaults to true because otherwise, you would end up with old trash being kept in the outDir while you organize your files (eg: if you rename files or remove directories from the publicDir) which is not desirable in the majority of cases.