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.
gdg-counter-website/vite.config.js

37 lines
927 B
JavaScript

import { readFile } from 'fs/promises'
2 years ago
import { defineConfig } from 'vite'
export default defineConfig({
server: {
port: 3000,
2 years ago
proxy: {
'/api': 'http://localhost:4000/',
},
2 years ago
},
build: {
rollupOptions: {
input: ['users.html'],
},
},
plugins: [
{
name: 'custom-routes',
configureServer(server) {
server.middlewares.use(async (req, res, next) => {
const url = new URL(req.url)
if (url.pathname.startsWith('/u/')) {
res.status(200)
.set({ 'Content-Type': 'text/html' })
.end(await readFile(path.resolve(__dirname, './users.html'), 'utf-8'))
return
}
next()
})
},
},
],
2 years ago
})