Files
web-app/vite.config.js

58 lines
1.3 KiB
JavaScript

import { defineConfig } from 'vite'
import { svelte } from '@sveltejs/vite-plugin-svelte'
import { VitePWA } from 'vite-plugin-pwa'
import { fileURLToPath, URL } from 'node:url'
export default defineConfig({
plugins: [
svelte({
onwarn(warning, handler) {
if (
warning.code.startsWith('a11y_') ||
warning.code === 'slot_element_deprecated' ||
warning.code === 'svelte_self_deprecated' ||
warning.code === 'non_reactive_update'
) {
return;
}
handler(warning);
}
}),
VitePWA({
registerType: 'autoUpdate',
workbox: {
globPatterns: ['**/*.{js,css,html,ico,png,svg,wasm}']
},
manifest: {
name: 'UnitPrint',
short_name: 'UnitPrint',
start_url: '/',
display: 'standalone',
background_color: '#ffffff',
theme_color: '#ff3e00',
icons: [
{
src: '/icon-192x192.png',
sizes: '192x192',
type: 'image/png'
}
]
}
})
],
resolve: {
alias: {
$lib: fileURLToPath(new URL('./src/lib', import.meta.url))
}
},
server: {
proxy: {
'/api': {
target: 'http://localhost:3000',
changeOrigin: true,
rewrite: (path) => path.replace(/^\/api/, '')
}
}
}
})