-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathvite.config.ts
More file actions
39 lines (38 loc) · 1.29 KB
/
Copy pathvite.config.ts
File metadata and controls
39 lines (38 loc) · 1.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import { defineConfig } from 'vite'
import { svelte } from '@sveltejs/vite-plugin-svelte'
import { resolve } from 'path'
// https://vite.dev/config/
export default defineConfig({
plugins: [svelte()],
base: './', // Use relative paths for browser extension
build: {
rollupOptions: {
input: {
popup: resolve(__dirname, 'popup.html'),
contacts: resolve(__dirname, 'contacts.html'),
relays: resolve(__dirname, 'relays.html'),
background: resolve(__dirname, 'src/background/background.ts'),
content: resolve(__dirname, 'src/content/content.ts'),
},
output: {
entryFileNames: (chunkInfo) => {
// Keep background and content scripts at root level with .js extension
if (chunkInfo.name === 'background' || chunkInfo.name === 'content') {
return '[name].js';
}
return 'assets/[name]-[hash].js';
},
chunkFileNames: 'assets/[name]-[hash].js',
assetFileNames: 'assets/[name]-[hash].[ext]',
format: 'es', // Use ES modules format
// Prevent code splitting for background and content scripts
manualChunks: undefined,
},
},
outDir: 'dist-chrome',
emptyOutDir: true,
target: 'esnext',
minify: false,
},
publicDir: 'public',
})