Support you webpage to be readed with the file protocol file://
in your browser
npm install -D vite-plugin-support-file-protocol
In your vite.config.ts
you can use it like this:
import { defineConfig } from 'vite'
import { supportViteBuildBundleForFileProtocol } from 'vite-plugin-support-file-protocol'
export default defineConfig({
plugins: [supportViteBuildBundleForFileProtocol()]
})