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.
|
|
|
import { readFile } from 'fs/promises'
|
|
|
|
|
|
|
|
import { defineConfig } from 'vite'
|
|
|
|
|
|
|
|
export default defineConfig({
|
|
|
|
server: {
|
|
|
|
port: 3000,
|
|
|
|
proxy: {
|
|
|
|
'/api': 'http://localhost:4000/',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
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()
|
|
|
|
})
|
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
|
|
|
})
|