Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In vite, is there a way to update the root html name from index.html

Tags:

vite

I'm trying to update an existing project to vite but i read in the docs Vite expects an index.html file to work from. Is there anyway to specify another file name from which vite should build? in my case main.html

like image 459
blu10 Avatar asked Sep 05 '25 03:09

blu10


1 Answers

The entry point is configured in build.rollupOptions.input:

import { defineConfig } from 'vite'
export default defineConfig({
  ⋮
  build: {
    rollupOptions: {
      input: {
        app: './index.html', // default
      },
    },
  },
})

You can change that to main.html, as shown below. When serving the app, you'll have to manually navigate to /main.html, but you could configure server.open to open that file automatically:

import { defineConfig } from 'vite'

export default defineConfig({
  ⋮
  build: {
    rollupOptions: {
      input: {
        app: './main.html',
      },
    },
  },
  server: {
    open: '/main.html',
  },
})

demo

like image 77
tony19 Avatar answered Sep 07 '25 23:09

tony19