30 lines
767 B
TypeScript
30 lines
767 B
TypeScript
import { defineConfig } from 'astro/config';
|
|
import type { Plugin } from 'vite';
|
|
import wisp from "wisp-server-node";
|
|
import node from '@astrojs/node';
|
|
import tailwindcss from '@tailwindcss/vite';
|
|
|
|
const viteWispServer = (): Plugin => {
|
|
return {
|
|
name: 'vite-wisp-server',
|
|
configureServer(server) {
|
|
server.httpServer?.on('upgrade', (req, socket, head) => {
|
|
console.log('3');
|
|
req.url.startsWith('/wisp') ? wisp.routeRequest(req, socket, head) : undefined
|
|
})
|
|
}
|
|
}
|
|
};
|
|
|
|
export default defineConfig({
|
|
vite: {
|
|
plugins: [
|
|
tailwindcss(),
|
|
viteWispServer()
|
|
]
|
|
},
|
|
output: 'server',
|
|
adapter: node({
|
|
mode: 'middleware'
|
|
})
|
|
});
|