nquest/frontend/vite.config.js

97 lines
2.7 KiB
JavaScript

import { defineConfig, splitVendorChunkPlugin } from 'vite'
import react from '@vitejs/plugin-react'
import { VitePWA } from 'vite-plugin-pwa'
const manifest = {
registerType: 'autoUpdate',
includeAssets: ['assets/icon.png', 'assets/logo.png'],
workbox: {
cleanupOutdatedCaches: true
},
base: 'assets',
manifest: {
name: 'NQuest',
short_name: 'NQuest',
description: 'NQuest - платформа для ARG игр.',
icons: [
{
src: 'assets/icons/icon-72x72.png',
sizes: '72x72',
type: 'image/png',
purpose: 'maskable any'
},
{
src: 'assets/icons/icon-96x96.png',
sizes: '96x96',
type: 'image/png',
purpose: 'maskable any'
},
{
src: 'assets/icons/icon-128x128.png',
sizes: '128x128',
type: 'image/png',
purpose: 'maskable any'
},
{
src: 'assets/icons/icon-144x144.png',
sizes: '144x144',
type: 'image/png',
purpose: 'maskable any'
},
{
src: 'assets/icons/icon-152x152.png',
sizes: '152x152',
type: 'image/png',
purpose: 'maskable any'
},
{
src: 'assets/icons/icon-192x192.png',
sizes: '192x192',
type: 'image/png',
purpose: 'maskable any'
},
{
src: 'assets/icons/icon-384x384.png',
sizes: '384x384',
type: 'image/png',
purpose: 'maskable any'
},
{
src: 'assets/icons/icon-512x512.png',
sizes: '512x512',
type: 'image/png',
purpose: 'maskable any'
}
],
theme_color: '#59FBEA',
background_color: '#171e26',
display: 'standalone',
scope: '/',
start_url: '/quests'
}
}
// https://vitejs.dev/config/
export default defineConfig({
plugins: [react(), splitVendorChunkPlugin(), VitePWA(manifest)],
server: {
proxy: {
'/api': {
target: 'http://localhost:8000',
changeOrigin: true,
secure: false,
ws: false
},
'/file': {
target: 'http://localhost:8000',
changeOrigin: true,
secure: false,
ws: false
}
}
},
build: {
// generate .vite/manifest.json in outDir
manifest: true
}
})