// We use a separate vite config here, since vite-plugin-singlefile can only have one entry point
// vite-plugin-singlefile is used to inline all assets so we can serve it up from an app origin

import { defineConfig } from 'vite';
import vue from '@vitejs/plugin-vue';
import { viteSingleFile } from 'vite-plugin-singlefile';
import { resolve } from 'path';
import injectMetaTags from './injectMetaTags.vite.plugin.js';

export default defineConfig({
  plugins: [
    vue(),
    injectMetaTags([
      resolve('proxyauth.html'),
    ]),
    viteSingleFile(),
  ],
  server: {
    fs: {
      // Allow serving files from one level up to the project root for monaco editor assets
      allow: [ '../../../' ]
    },
  },
  // https://vitejs.dev/guide/build.html#multi-page-app
  build: {
    emptyOutDir: false, // we share dist/
    rollupOptions: {
      input: {
        proxyauth: resolve('proxyauth.html'),
      },
    },
  },
});
