steelforesight/frontend/vite.config.ts

41 lines
985 B
TypeScript

import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import tailwindcss from '@tailwindcss/vite'
import path from 'path'
// hosts allowed through Vite's host check (for tunnels: tunnelmole, localtunnel, cloudflare)
const ALLOWED_TUNNEL_HOSTS = ['.tunnelmole.net', '.loca.lt', '.trycloudflare.com']
const CMS_TARGET = 'https://cms-steelforesight.liara.run'
export default defineConfig({
plugins: [react(), tailwindcss()],
resolve: {
alias: {
'@': path.resolve(__dirname, './src'),
},
},
server: {
allowedHosts: ALLOWED_TUNNEL_HOSTS,
proxy: {
'/api': {
target: CMS_TARGET,
changeOrigin: true,
secure: true,
},
'/uploads': {
target: CMS_TARGET,
changeOrigin: true,
secure: true,
},
'/media': {
target: CMS_TARGET,
changeOrigin: true,
secure: true,
},
},
},
preview: {
allowedHosts: ALLOWED_TUNNEL_HOSTS,
},
})