spotify-clone/frontend-vite/vite.config.ts

62 lines
1.9 KiB
TypeScript

import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import { VitePWA } from 'vite-plugin-pwa'
import path from 'path'
import { fileURLToPath } from 'url'
const __dirname = path.dirname(fileURLToPath(import.meta.url))
// https://vitejs.dev/config/
export default defineConfig({
plugins: [
react(),
VitePWA({
registerType: 'autoUpdate',
includeAssets: ['favicon.ico', 'apple-touch-icon.png', 'mask-icon.svg'],
manifest: {
name: 'Spotify Clone',
short_name: 'Spotify Clone',
description: 'A modern Spotify Clone built with Vite and Go',
theme_color: '#121212',
background_color: '#121212',
display: 'standalone',
scope: '/',
start_url: '/',
orientation: 'portrait',
icons: [
{
src: 'pwa-192x192.png',
sizes: '192x192',
type: 'image/png'
},
{
src: 'pwa-512x512.png',
sizes: '512x512',
type: 'image/png'
},
{
src: 'pwa-512x512.png',
sizes: '512x512',
type: 'image/png',
purpose: 'any maskable'
}
]
}
})
],
resolve: {
alias: {
"@": path.resolve(__dirname, "./src"),
},
},
server: {
host: true, // Needed for PWA testing on network
proxy: {
'/api': {
target: 'http://localhost:8080',
changeOrigin: true,
}
},
allowedHosts: true, // Allow ngrok tunneling
}
})