48 lines
1.5 KiB
TypeScript
48 lines
1.5 KiB
TypeScript
import adapter from '@sveltejs/adapter-node';
|
|
import { sveltekit } from '@sveltejs/kit/vite';
|
|
import tailwindcss from '@tailwindcss/vite';
|
|
import { defineConfig } from 'vite';
|
|
|
|
export default defineConfig({
|
|
plugins: [
|
|
tailwindcss(),
|
|
sveltekit({
|
|
compilerOptions: {
|
|
runes: ({ filename }) =>
|
|
filename.split(/[/\\]/).includes('node_modules') ? undefined : true
|
|
},
|
|
adapter: adapter()
|
|
})
|
|
],
|
|
server: {
|
|
port: 5173,
|
|
proxy: {
|
|
// Proxy API + WebSocket to the existing f0ckm backend
|
|
'/api': {
|
|
target: 'http://localhost:1337',
|
|
changeOrigin: true
|
|
},
|
|
'/ajax': {
|
|
target: 'http://localhost:1337',
|
|
changeOrigin: true
|
|
},
|
|
'/ws': {
|
|
target: 'ws://localhost:1337',
|
|
ws: true
|
|
},
|
|
// Static media files — use exact prefix matching to avoid
|
|
// colliding with Vite's own /src/ module paths.
|
|
// Each rule anchored to exactly /X/ (with trailing slash).
|
|
'^/b/': { target: 'http://localhost:1337', changeOrigin: true },
|
|
'^/t/': { target: 'http://localhost:1337', changeOrigin: true },
|
|
'^/ca/': { target: 'http://localhost:1337', changeOrigin: true },
|
|
'^/a/': { target: 'http://localhost:1337', changeOrigin: true },
|
|
// /s/ — NOTE: must NOT match /src/ — regex anchors it
|
|
'^/s/': { target: 'http://localhost:1337', changeOrigin: true },
|
|
'^/memes/': { target: 'http://localhost:1337', changeOrigin: true },
|
|
// mod actions (pin, unpin, delete)
|
|
'^/mod/': { target: 'http://localhost:1337', changeOrigin: true }
|
|
}
|
|
}
|
|
});
|