-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvite.config.js
More file actions
46 lines (42 loc) · 1.24 KB
/
vite.config.js
File metadata and controls
46 lines (42 loc) · 1.24 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
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
import { resolve } from 'path';
import { copyFileSync, mkdirSync, readdirSync, existsSync } from 'fs';
export default defineConfig({
plugins: [
react(),
{
name: 'copy-files',
closeBundle() {
// Copy manifest
copyFileSync('manifest.json', 'dist/manifest.json');
// Create dist/icons directory
mkdirSync('dist/icons', { recursive: true });
// Copy all icon files
const iconFiles = readdirSync('icons');
iconFiles.forEach(file => {
if (file.endsWith('.png') || file.endsWith('.svg')) {
copyFileSync(`icons/${file}`, `dist/icons/${file}`);
}
});
console.log('Copied icons to dist/icons/');
}
}
],
build: {
rollupOptions: {
input: {
popup: resolve(__dirname, 'public/index.html'),
content: resolve(__dirname, 'src/content.js'),
background: resolve(__dirname, 'src/background.js')
},
output: {
entryFileNames: 'src/[name].js',
chunkFileNames: 'src/[name].js',
assetFileNames: 'src/[name].[ext]'
}
},
minify: false,
outDir: 'dist'
}
});