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
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With