owntone-server/web-src/vite.config.js

59 lines
1.3 KiB
JavaScript
Raw Normal View History

2022-05-20 07:44:22 -04:00
import path from 'path'
2022-02-19 00:18:01 -05:00
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import vueI18n from '@intlify/unplugin-vue-i18n/vite'
2022-02-19 00:18:01 -05:00
// Support for setting the OwnTone server URL as env var VITE_OWNTONE_URL
// in development mode.
// E. g. start the DEV server with
//
2022-05-20 07:44:22 -04:00
// VITE_OWNTONE_URL=https://owntone.local:3689; npm run serve
//
// will connect the web interface with a remote OwnTone server.
2022-05-29 12:51:23 -04:00
const owntoneUrl = process.env.VITE_OWNTONE_URL ?? 'http://localhost:3689'
2022-02-19 00:18:01 -05:00
// https://vitejs.dev/config/
export default defineConfig({
resolve: { alias: { '@': '/src' } },
2022-05-20 07:44:22 -04:00
plugins: [
vue(),
vueI18n({
include: path.resolve(__dirname, './src/locales/**')
})
],
pluginOptions: {
i18n: {
locale: 'en',
fallbackLocale: 'en',
localeDir: 'locales',
enableLegacy: false,
runtimeOnly: false,
compositionOnly: false,
fullInstall: true
}
},
2022-02-19 00:18:01 -05:00
build: {
outDir: '../htdocs',
rollupOptions: {
output: {
entryFileNames: `assets/[name].js`,
chunkFileNames: `assets/[name].js`,
assetFileNames: `assets/[name].[ext]`
}
}
},
server: {
proxy: {
'/api': {
target: owntoneUrl
2022-02-19 00:18:01 -05:00
},
'/artwork': {
target: owntoneUrl
2022-02-19 00:18:01 -05:00
},
'/stream.mp3': {
target: owntoneUrl
2022-02-19 00:18:01 -05:00
}
}
}
})