-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvite.config.ts
More file actions
43 lines (42 loc) · 1.16 KB
/
Copy pathvite.config.ts
File metadata and controls
43 lines (42 loc) · 1.16 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
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
import { copyFileSync } from 'fs';
import { resolve } from 'path';
export default defineConfig({
plugins: [
react(),
{
name: 'copy-manifest',
closeBundle() {
copyFileSync(
resolve(__dirname, 'manifest.json'),
resolve(__dirname, 'dist/manifest.json')
);
},
},
],
publicDir: 'public',
build: {
outDir: 'dist',
emptyOutDir: true,
rollupOptions: {
input: {
index: 'index.html', // main simulator window
background: 'src/background/index.ts',
content: 'src/content/index.ts',
frameGuard: 'src/frame-guard/index.ts',
},
output: {
entryFileNames: (chunk) => {
if (chunk.name === 'background') return 'background.js';
if (chunk.name === 'content') return 'content.js';
if (chunk.name === 'frameGuard') return 'frame-guard.js';
return 'assets/[name].js';
},
chunkFileNames: 'assets/[name].js',
assetFileNames: 'assets/[name][extname]',
},
},
},
server: { port: 3000 },
});