Merely setting build.rollupOptions.input
forces a script to be generated even if the page has none (whereas the default behavior doesn't generate the empty js file):
vite.config.js
points to the same default location:
export default {
build: {
rollupOptions: {
input: "index.html"
}
}