-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvite.config.ts
More file actions
70 lines (67 loc) · 2.13 KB
/
vite.config.ts
File metadata and controls
70 lines (67 loc) · 2.13 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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
import { defineConfig, type Plugin } from 'vite';
import { resolve } from 'path';
import { copyFileSync, cpSync, mkdirSync, existsSync } from 'fs';
import tailwindcss from '@tailwindcss/vite';
function copyManifestAndAssets(): Plugin {
return {
name: 'copy-manifest-and-assets',
closeBundle() {
// Copy manifest.json
copyFileSync(
resolve(__dirname, 'src/manifest.json'),
resolve(__dirname, 'dist/manifest.json'),
);
// Copy icons
const iconsDir = resolve(__dirname, 'dist/assets/icons');
if (!existsSync(iconsDir)) {
mkdirSync(iconsDir, { recursive: true });
}
cpSync(
resolve(__dirname, 'src/assets/icons'),
iconsDir,
{ recursive: true },
);
},
};
}
export default defineConfig({
resolve: {
alias: {
'@': resolve(__dirname, 'src'),
'@core': resolve(__dirname, 'src/core'),
'@providers': resolve(__dirname, 'src/providers'),
'@automation': resolve(__dirname, 'src/automation'),
'@chat': resolve(__dirname, 'src/chat'),
'@mcp': resolve(__dirname, 'src/mcp'),
'@shared': resolve(__dirname, 'src/shared'),
'@types': resolve(__dirname, 'src/types'),
},
},
build: {
outDir: 'dist',
emptyOutDir: true,
sourcemap: process.env.NODE_ENV === 'development',
rollupOptions: {
input: {
'service-worker': resolve(__dirname, 'src/background/service-worker.ts'),
sidebar: resolve(__dirname, 'src/chat/sidebar.html'),
popup: resolve(__dirname, 'src/popup/popup.html'),
'content-script': resolve(__dirname, 'src/automation/content-scripts/bridge.ts'),
},
output: {
entryFileNames: (chunkInfo) => {
if (chunkInfo.name === 'content-script') {
return 'content-scripts/[name].js';
}
if (chunkInfo.name === 'service-worker') {
return '[name].js';
}
return 'assets/[name]-[hash].js';
},
chunkFileNames: 'assets/[name]-[hash].js',
assetFileNames: 'assets/[name]-[hash].[ext]',
},
},
},
plugins: [tailwindcss(), copyManifestAndAssets()],
});