Social Annotations in the Atmosphere
1import { defineConfig } from 'vite';
2import path from 'path';
3import { getEnvDefines } from './vite.proxy.shared';
4
5// Vite config for proxy
6// Builds the shell (with embedded sidebar) and oauth HTML pages (ES modules)
7// The seams-client.js is built separately as IIFE (see vite.proxy-inject.config.ts)
8export default defineConfig({
9 // Set root to proxy/ so HTML outputs aren't nested
10 root: path.resolve(__dirname, 'proxy'),
11 // Base path - files served from root of static server
12 base: '/',
13 // Copy static files from proxy/public to dist (includes sw.js, index.html, etc.)
14 publicDir: 'public',
15 build: {
16 outDir: 'dist',
17 emptyOutDir: true,
18 sourcemap: true,
19 rollupOptions: {
20 input: {
21 // Shell - manages BackgroundWorker, storage, and renders Sidebar directly
22 'seams-shell': path.resolve(__dirname, 'proxy/seams-shell.html'),
23 // OAuth callback page (still needed for popup OAuth flow)
24 'oauth-callback': path.resolve(__dirname, 'proxy/oauth-callback.html'),
25 },
26 output: {
27 entryFileNames: '[name].js',
28 chunkFileNames: 'assets/[name]-[hash].js',
29 assetFileNames: 'assets/[name]-[hash][extname]',
30 format: 'es',
31 },
32 },
33 },
34 resolve: {
35 alias: {
36 '@': path.resolve(__dirname, './'),
37 },
38 },
39 define: getEnvDefines(),
40});