traccar-web/vite.config.js

54 lines
1.3 KiB
JavaScript
Raw Permalink Normal View History

2023-08-20 04:58:45 +08:00
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
import svgr from 'vite-plugin-svgr';
2023-08-20 05:02:52 +08:00
import { VitePWA } from 'vite-plugin-pwa';
2023-08-20 04:58:45 +08:00
2023-08-27 06:35:46 +08:00
/* eslint-disable no-template-curly-in-string */
2023-08-20 05:02:52 +08:00
export default defineConfig(() => ({
server: {
port: 3000,
proxy: {
'/api/socket': 'ws://localhost:8082',
'/api': 'http://localhost:8082',
2023-08-20 04:58:45 +08:00
},
2023-08-20 05:02:52 +08:00
},
build: {
outDir: 'build',
},
2023-08-27 06:31:10 +08:00
plugins: [
svgr(),
react(),
VitePWA({
includeAssets: ['favicon.ico', 'apple-touch-icon-180x180.png'],
2023-08-27 06:31:10 +08:00
workbox: {
navigateFallbackDenylist: [/^\/api/],
2024-08-24 07:34:26 +08:00
maximumFileSizeToCacheInBytes: 10 * 1024 * 1024,
globPatterns: ['**/*.{js,css,html,woff,woff2,mp3}'],
2023-08-27 06:31:10 +08:00
},
manifest: {
short_name: '${title}',
name: '${description}',
theme_color: '${colorPrimary}',
icons: [
{
2023-08-27 06:55:52 +08:00
src: 'pwa-64x64.png',
sizes: '64x64',
type: 'image/png',
2023-08-27 06:31:10 +08:00
},
{
2023-08-27 06:55:52 +08:00
src: 'pwa-192x192.png',
2023-08-27 06:31:10 +08:00
sizes: '192x192',
2023-08-27 06:55:52 +08:00
type: 'image/png',
2023-08-27 06:31:10 +08:00
},
{
2023-08-27 06:55:52 +08:00
src: 'pwa-512x512.png',
2023-08-27 06:31:10 +08:00
sizes: '512x512',
2023-08-27 06:55:52 +08:00
type: 'image/png',
2023-08-27 06:31:10 +08:00
purpose: 'any maskable',
},
],
},
}),
],
2023-08-20 05:02:52 +08:00
}));