-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvite.config.js
129 lines (125 loc) · 2.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
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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
import path from "path";
import vueI18n from "@intlify/vite-plugin-vue-i18n";
import vue from "@vitejs/plugin-vue";
// import { VitePWA } from 'vite-plugin-pwa'
import alias from "@rollup/plugin-alias";
import Pages from "vite-plugin-pages";
import WindiCSS from "vite-plugin-windicss";
import AutoImport from "unplugin-auto-import/vite";
import Components from "unplugin-vue-components/vite";
import Unocss from "unocss/vite";
import presetIcons from "@unocss/preset-icons";
import extractorPug from "@unocss/extractor-pug";
import { extractorSplit } from "@unocss/core";
const moduleExclude = (match) => {
const m = (id) => id.indexOf(match) > -1;
return {
name: `exclude-${match}`,
resolveId(id) {
if (m(id)) return id;
},
load(id) {
if (m(id)) return `export default {}`;
},
};
};
export default {
build: {
rollupOptions: {
external: ["text-encoding", "@peculiar/webcrypto"],
},
},
server: {
port: 3000,
},
optimizeDeps: {
include: [
"gun",
"gun/gun",
"gun/sea",
"gun/sea.js",
"gun/lib/then",
"gun/lib/webrtc",
"gun/lib/radix",
"gun/lib/radisk",
"gun/lib/store",
"gun/lib/rindexed",
"vue",
"@vueuse/core",
],
},
plugins: [
moduleExclude("text-encoding"),
// VitePWA({
// manifest: {
// name: 'Project app',
// theme_color: '#777',
// icons: [
// {
// src: '/icons/feeds192.png',
// type: 'image/png',
// sizes: '192x192',
// },
// {
// src: '/icons/feeds512.png',
// type: 'image/png',
// sizes: '512x512',
// },
// ],
// },
// }),
alias({
entries: [
{ find: /^store\@(.*)/, replacement: "/src/store/$1.js" },
{ find: /^use\@(.*)/, replacement: "/src/use/$1.js" },
],
}),
vue(),
Pages({
dirs: "src/pages",
importMode: "sync",
}),
Unocss({
extractors: [extractorPug(), extractorSplit],
presets: [
presetIcons({
/* options */
}),
// ...other presets
],
}),
WindiCSS({
scan: {
dirs: ["src/", "./"],
include: ["index.md"],
exclude: ["/node_modules/"],
fileExtensions: ["vue", "ts", "md"],
},
}),
AutoImport({
// targets to transform
include: [
/\.[tj]sx?$/, // .ts, .tsx, .js, .jsx
/\.vue\??/, // .vue
],
imports: [
"vue",
{
"@vueuse/core": ["useStorage"],
},
],
}),
Components({
dirs: ["src/components"],
extensions: ["vue", "ts", "js"],
directoryAsNamespace: true,
globalNamespaces: ["global"],
include: [/\.vue$/, /\.vue\?vue/, /\.md$/],
exclude: [/node_modules/, /\.git/],
}),
vueI18n({
compositionOnly: false,
include: path.resolve(__dirname, "./src/locales/**"),
}),
],
};