-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvite.config.js
61 lines (60 loc) · 1.96 KB
/
vite.config.js
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
import { fileURLToPath, URL } from 'node:url'
import { resolve } from 'path';
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import vueJsx from '@vitejs/plugin-vue-jsx'
import Components from 'unplugin-vue-components/vite'
import { NaiveUiResolver } from 'unplugin-vue-components/resolvers'
import Unocss from 'unocss/vite'
import { presetWind, presetIcons, presetUno } from 'unocss'
export default defineConfig({
server: {
open: '/popup.html'
},
plugins: [
vue(),
vueJsx(),
Unocss({
presets: [
presetWind(), // 这个是可选的
presetIcons(), // 确保已经启用了 Icons 预设
],
}),
Components({
resolvers: [NaiveUiResolver()]
})
],
resolve: {
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url))
}
},
build: {
rollupOptions: {
output: {
// 在这里设置资产文件命名策略
chunkFileNames: 'static/js/[name]-[hash].js',
entryFileNames: (chunkInfo) => {
const contentFiles = ['content', 'getAPI', 'notification'];
if (chunkInfo.name === 'background') {
return '[name].js';
}
if (contentFiles.includes(chunkInfo.name)) {
return `static/content/${chunkInfo.name === 'notification' ? 'notification/' : ''}[name].js`;
}
return 'static/js/[name]-[hash].js';
},
assetFileNames: 'static/[ext]/[name]-[hash].[ext]'
},
input: {
popup: resolve(__dirname, 'popup.html'),
options: resolve(__dirname, 'options.html'),
uplaodLog: resolve(__dirname, 'uplaodlog.html'),
background: resolve(__dirname, 'src/background/background.js'),
content: resolve(__dirname, 'src/content/content.js'),
getAPI: resolve(__dirname, 'src/content/getAPI.js'),
notification: resolve(__dirname, 'src/content/notification/notification.js') // 添加 notification 文件路径
},
}
}
})