funquail/front/vite.config.ts
jo b359bb6498 fix: timeout on spa manifest requests
The previous behaviour had a loop of requests between the front
app and the api when querying the pwa manifest.

This reduce the coupling around the pwa manifest file between the api
and the front app, by uplicating the files so each "service" has a copy
of it, while keeping them in sync and having the front pwa manifest as
single source of truth.

Part-of: <https://dev.funkwhale.audio/funkwhale/funkwhale/-/merge_requests/2291>
2022-12-19 14:33:12 +01:00

62 lines
1.5 KiB
TypeScript

import { defineConfig } from 'vite'
import Vue from '@vitejs/plugin-vue'
import Inspector from 'vite-plugin-vue-inspector'
import VueI18n from '@intlify/vite-plugin-vue-i18n'
import { VitePWA } from 'vite-plugin-pwa'
import { resolve } from 'path'
import manifest from './pwa-manifest.json'
const port = +(process.env.VUE_PORT ?? 8080)
// https://vitejs.dev/config/
export default defineConfig(({ mode }) => ({
envPrefix: ['VUE_', 'FUNKWHALE_SENTRY_'],
plugins: [
// https://github.com/vitejs/vite/tree/main/packages/plugin-vue
Vue(),
// https://github.com/intlify/bundle-tools/tree/main/packages/vite-plugin-vue-i18n
VueI18n({
include: resolve(__dirname, './src/locales/**')
}),
// https://github.com/webfansplz/vite-plugin-vue-inspector
Inspector({
toggleComboKey: 'alt-shift-d'
}),
// https://github.com/antfu/vite-plugin-pwa
VitePWA({
strategies: 'injectManifest',
srcDir: 'src',
filename: 'serviceWorker.ts',
manifestFilename: 'manifest.json',
devOptions: {
enabled: true,
type: 'module',
navigateFallback: 'index.html'
},
manifest
})
],
server: {
port
},
resolve: {
alias: {
'#': resolve(__dirname, './src/worker'),
'?': resolve(__dirname, './test'),
'~': resolve(__dirname, './src')
}
},
test: {
environment: 'jsdom',
globals: true,
coverage: {
src: './src',
all: true,
reporter: ['text', 'cobertura']
}
}
}))