forked from phc/cluster-dashboard
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.
35 lines
880 B
JavaScript
35 lines
880 B
JavaScript
2 years ago
|
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',
|
||
|
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()],
|
||
|
}
|
||
|
})
|