HackerNewsFullstack/frontend/vite.config.js
2022-04-01 17:03:49 +02:00

49 lines
1.1 KiB
JavaScript

import {
fileURLToPath,
URL
} from 'url'
import {
resolve
} from 'path'
import {
defineConfig
} from 'vite'
import vue from '@vitejs/plugin-vue'
// https://vitejs.dev/config/
export default defineConfig({
build: {
outDir: resolve(__dirname, '../templates'),
assetsDir: 'static',
manifest: true
},
plugins: [vue()],
resolve: {
alias: {
'@': fileURLToPath(new URL('./src',
import.meta.url))
}
},
server: {
proxy: {
"/api": {
target: "https://127.0.0.1:5000/",
changeOrigin: true,
secure: false,
rewrite: (path) => path.replace(/^\/api/, ""),
},
"/hackernews": {
target: "https://hacker-news.firebaseio.com/",
changeOrigin: true,
secure: false,
ws: true
//rewrite: (path) => path.replace(/^\/hackernews/, "/v0/item/"),
}
},
cors: true,
headers: {
"Access-Control-Allow-Origin": "https://localhost:3000"
}
}
})