You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

36 lines
920 B
JavaScript

import { defineConfig } from 'vite'
import { getBuildRoutes } from './meta/routes.js'
import preactPlugin from '@preact/preset-vite'
import { join } from 'path'
export default defineConfig(async () => {
const routes = await getBuildRoutes()
console.log('html entrypoints:')
for (const [route, filename] of Object.entries(routes)) {
console.log(`- "${route}" => ${filename}`)
}
console.log()
const entryPoints = Object.values(routes)
return {
root: './frontend',
publicDir: './frontend/public',
build: {
outDir: '../out/frontend',
emptyOutDir: true,
rollupOptions: {
input: entryPoints.map(e => join('./frontend', e)),
},
},
server: {
proxy: {
'/api': 'http://127.0.0.1:4000/',
},
},
plugins: [preactPlugin()],
}
})