-
Notifications
You must be signed in to change notification settings - Fork 5
/
wxt.config.ts
90 lines (84 loc) · 2.03 KB
/
wxt.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
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
import { defineConfig } from 'wxt'
import AutoImport from 'unplugin-auto-import/vite'
import Components from 'unplugin-vue-components/vite'
import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'
import svgLoader from 'vite-svg-loader'
import vueJsx from '@vitejs/plugin-vue-jsx'
import optimizeDeps from './utils/optimizeDeps'
const baseManifest = {
name: '__MSG_extension_name__',
author: 'Red_lnn<[email protected]>',
description: '__MSG_extension_description__',
default_locale: 'zh_CN',
icons: {
512: '/icon.png'
},
host_permissions: [
'https://www.bing.com/',
'https://api.bing.com/',
'https://suggestion.baidu.com/',
'https://suggestqueries.google.com/',
'https://v2.jinrishici.com/'
]
}
const firefoxManifest = {
...baseManifest,
permissions: ['topSites', 'storage'],
chrome_settings_overrides: {
homepage: 'newtab.html'
}
}
const chromeManifest = {
...baseManifest,
permissions: ['topSites', 'storage', 'favicon'],
optional_host_permissions: ['*://*/*']
}
// See https://wxt.dev/api/config.html
export default defineConfig({
modules: ['@wxt-dev/module-vue', '@wxt-dev/i18n/module'],
manifest: ({ browser }) => {
if (browser === 'firefox') {
return firefoxManifest
} else {
return chromeManifest
}
},
vite: () => ({
plugins: [
svgLoader(),
vueJsx(),
AutoImport({
resolvers: [
ElementPlusResolver({
importStyle: 'sass'
})
],
dts: 'types/auto-imports.d.ts'
}),
Components({
resolvers: [
ElementPlusResolver({
importStyle: 'sass'
})
],
dts: 'types/components.d.ts'
})
],
resolve: {
alias: {
'@/newtab': '/entrypoints/newtab'
}
},
css: {
preprocessorOptions: {
scss: {
additionalData: `@use "@/styles/element/index.scss" as *;`,
api: 'modern-compiler'
}
}
},
optimizeDeps: {
include: optimizeDeps
}
})
})