forked from gp0119/Taby
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvite.config.ts
More file actions
66 lines (65 loc) · 1.68 KB
/
vite.config.ts
File metadata and controls
66 lines (65 loc) · 1.68 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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
import { defineConfig } from "vite"
import vue from "@vitejs/plugin-vue"
import AutoImport from "unplugin-auto-import/vite"
import Components from "unplugin-vue-components/vite"
import { NaiveUiResolver } from "unplugin-vue-components/resolvers"
import vueJsx from "@vitejs/plugin-vue-jsx"
import { crx } from "@crxjs/vite-plugin"
import manifest from "./manifest.config"
import zip from "vite-plugin-zip-pack"
import fs from "fs"
import path from "path"
export default defineConfig({
plugins: [
vue(),
crx({ manifest }),
zip({ outDir: "release", outFileName: "release.zip" }),
vueJsx({}),
{
name: "remove-vite-manifest",
closeBundle() {
const manifestPath = path.resolve(__dirname, "dist/.vite/manifest.json")
if (fs.existsSync(manifestPath)) {
fs.unlinkSync(manifestPath)
const viteDir = path.resolve(__dirname, "dist/.vite")
if (fs.readdirSync(viteDir).length === 0) {
fs.rmdirSync(viteDir)
}
}
},
},
AutoImport({
imports: [
"vue",
{
"naive-ui": [
"useDialog",
"useMessage",
"useNotification",
"useLoadingBar",
],
},
],
dts: "src/auto-imports.d.ts",
eslintrc: {
enabled: true,
filepath: "./.eslintrc-auto-import.json",
globalsPropValue: true,
},
}),
Components({
resolvers: [NaiveUiResolver()],
}),
],
resolve: {
alias: [
{ find: "@", replacement: "/src" },
{ find: "@components", replacement: "/src/components" },
],
},
server: {
cors: {
origin: [/chrome-extension:\/\//],
},
},
})