funkwhale/front/vite.config.ts

107 wiersze
2.8 KiB
TypeScript
Czysty Zwykły widok Historia

2023-05-20 11:43:21 +00:00
import { visualizer } from 'rollup-plugin-visualizer'
import { defineConfig, type PluginOption } from 'vite'
2022-04-30 13:25:59 +00:00
import { VitePWA } from 'vite-plugin-pwa'
import { resolve } from 'path'
2022-02-21 14:07:07 +00:00
import manifest from './pwa-manifest.json'
2023-05-20 11:43:21 +00:00
import VueI18n from '@intlify/unplugin-vue-i18n/vite'
import Vue from '@vitejs/plugin-vue'
2023-09-01 12:09:58 +00:00
import VueMacros from 'unplugin-vue-macros/vite'
2023-11-13 09:43:18 +00:00
import VueDevTools from 'vite-plugin-vue-devtools'
import { fileURLToPath, URL } from "url"
2022-02-21 14:07:07 +00:00
const port = +(process.env.VUE_PORT ?? 8080)
2022-06-23 17:21:06 +00:00
2022-02-21 14:07:07 +00:00
// https://vitejs.dev/config/
2022-07-31 19:40:31 +00:00
export default defineConfig(({ mode }) => ({
2022-08-05 17:14:17 +00:00
envPrefix: ['VUE_', 'FUNKWHALE_SENTRY_'],
plugins: [
2023-11-13 09:43:18 +00:00
// https://github.com/webfansplz/vite-plugin-vue-devtools
VueDevTools(),
2023-09-01 12:09:58 +00:00
// https://vue-macros.sxzz.moe/
VueMacros({
plugins: {
// https://github.com/vitejs/vite/tree/main/packages/plugin-vue
vue: Vue(),
}
}),
2022-07-31 19:40:31 +00:00
2022-09-10 16:31:48 +00:00
// https://github.com/intlify/bundle-tools/tree/main/packages/vite-plugin-vue-i18n
VueI18n({
include: resolve(__dirname, './src/locales/**')
}),
// https://github.com/btd/rollup-plugin-visualizer
visualizer() as unknown as PluginOption,
2022-04-30 13:25:59 +00:00
// https://github.com/antfu/vite-plugin-pwa
VitePWA({
strategies: 'injectManifest',
srcDir: 'src',
filename: 'serviceWorker.ts',
manifestFilename: 'manifest.json',
2022-04-30 13:25:59 +00:00
devOptions: {
enabled: true,
type: 'module',
navigateFallback: 'index.html'
},
manifest
2022-07-20 18:49:11 +00:00
})
2022-06-23 17:21:06 +00:00
],
2022-07-21 14:13:42 +00:00
server: {
2022-07-21 19:36:08 +00:00
port
2022-07-21 14:13:42 +00:00
},
2023-11-13 09:43:18 +00:00
css: {
preprocessorOptions: {
scss: {
additionalData: `
@use "./src/style/global-vars" as *;
`
}
2022-06-23 17:21:06 +00:00
}
2022-04-02 17:38:14 +00:00
},
2023-11-13 09:43:18 +00:00
resolve: {
alias: [
{ find: '#', replacement: fileURLToPath(new URL('./src/worker', import.meta.url)) },
{ find: '?', replacement: fileURLToPath(new URL('./test', import.meta.url)) },
{ find: '~', replacement: fileURLToPath(new URL('./src', import.meta.url)) }
]
},
build: {
2023-09-01 12:09:58 +00:00
sourcemap: true,
// https://rollupjs.org/configuration-options/
rollupOptions: {
output: {
manualChunks: {
'axios': ['axios', 'axios-auth-refresh'],
'dompurify': ['dompurify'],
'jquery': ['jquery'],
'lodash': ['lodash-es'],
'moment': ['moment'],
'sentry': ['@sentry/vue', '@sentry/tracing'],
'standardized-audio-context': ['standardized-audio-context'],
'vue-router': ['vue-router'],
}
}
}
},
2022-08-31 22:36:40 +00:00
test: {
environment: 'jsdom',
2022-09-15 17:37:44 +00:00
globals: true,
reporters: ['default', 'junit'],
outputFile: "./test_results.xml",
2022-09-15 17:37:44 +00:00
coverage: {
src: './src',
all: true,
reporter: ['text', 'cobertura']
},
setupFiles: [
'./test/setup/mock-audio-context.ts',
2023-09-01 12:09:58 +00:00
'./test/setup/mock-vue-i18n.ts'
]
2022-06-13 09:53:36 +00:00
}
}))