-
Notifications
You must be signed in to change notification settings - Fork 0
/
vite.config.ts
31 lines (30 loc) · 947 Bytes
/
vite.config.ts
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
import { parse, resolve } from 'path';
import { defineConfig, UserConfigExport } from 'vite';
import { combineRules } from './plugins/combineRules';
// https://vitejs.dev/config/
export default defineConfig({
root: 'src',
publicDir: 'src/static',
build: {
rollupOptions: {
input: {
background: resolve(__dirname, 'src', 'background', 'index.ts'),
content: resolve(__dirname, 'src', 'contentScript', 'index.ts'),
editor: resolve(__dirname, 'src', 'editor.html'),
popup: resolve(__dirname, 'src', 'popup.html')
},
output: {
dir: "dist",
chunkFileNames: "[name].[hash].js",
entryFileNames: "[name].js",
assetFileNames: (assetInfo) => {
const { name } = parse(assetInfo.name);
return `${name}.[ext]`;
},
},
}
},
plugins: [
process.env.NODE_ENV === 'production' ? combineRules() : null
]
} as UserConfigExport);