Build a Vue project into a single HTML file.

‘vite-plugin-singlefile’ allows you to inline all JavaScript and CSS resources directly into the final index.html file.

To install type this in command prompt


npm install vite-plugin-singlefile

Add the given code in vite.config.js

import { viteSingleFile } from "vite-plugin-singlefile"
export default defineConfig({
	plugins: [vue(), viteSingleFile()],
})

Build the app and now a single index.html file will be created.

Leave a comment

Your email address will not be published. Required fields are marked *