20 lines
672 B
TypeScript
20 lines
672 B
TypeScript
import { defineConfig, loadEnv } from 'vite';
|
|
import vue from '@vitejs/plugin-vue';
|
|
import { iceMiddleware } from './dev/ice-server.ts';
|
|
|
|
// Relative paths let the hosted build work from any static subdirectory.
|
|
export default defineConfig(({ mode }) => {
|
|
const env = { ...loadEnv(mode, process.cwd(), ''), ...process.env };
|
|
return {
|
|
base: './',
|
|
build: { rollupOptions: { output: { format: 'iife' } } },
|
|
server: { host: '127.0.0.1' },
|
|
plugins: [vue(), {
|
|
name: 'local-turn-credentials',
|
|
configureServer(server) {
|
|
if (env.VITE_ICE_ENDPOINT === '/api/ice-servers') server.middlewares.use(iceMiddleware(env));
|
|
},
|
|
}],
|
|
};
|
|
});
|