This repository was archived by the owner on Feb 5, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvite.config.ts
More file actions
48 lines (46 loc) · 1.43 KB
/
vite.config.ts
File metadata and controls
48 lines (46 loc) · 1.43 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
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react-swc';
import tailwindcss from "@tailwindcss/vite";
import path, { resolve } from 'path';
import fs from 'fs';
const contentScriptsEntries = Object.fromEntries(
fs.readdirSync('src/content-scripts')
.filter(file => file.endsWith('.ts') || file.endsWith('.tsx'))
.map(file => [
file.replace(/\.(ts|tsx)$/, ''), // content-scripts/ 빼기
resolve(__dirname, `src/content-scripts/${file}`)
])
);
export default defineConfig({
plugins: [react(), tailwindcss()],
resolve: {
alias: [
{ find: "@", replacement: path.resolve(__dirname, "src") },
],
},
base: './',
root: 'src/side-panel',
build: {
outDir: path.resolve(__dirname, 'dist'), // 루트 경로 기준 dist
emptyOutDir: true,
rollupOptions: {
input: {
'side-panel': path.resolve(__dirname, 'src/side-panel/index.html'),
'service-worker': path.resolve(__dirname, 'src/service-worker/index.ts'),
...contentScriptsEntries,
},
output: {
entryFileNames: assetInfo => {
if (contentScriptsEntries[assetInfo.name]) {
return `content-scripts/${assetInfo.name}.js`;
}
if (assetInfo.name === 'service-worker') {
return 'service-worker/index.js';
}
return '[name]/index.js';
},
},
},
},
publicDir: path.resolve(__dirname, 'public'),
});