-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathvite.config.ts
More file actions
169 lines (166 loc) · 4.51 KB
/
Copy pathvite.config.ts
File metadata and controls
169 lines (166 loc) · 4.51 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
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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
import { defineConfig, loadEnv } from "vite"
import { APP_INFO, META_TAGS } from "./meta"
import generateSitemap from "vite-plugin-pages-sitemap"
import HtmlConfig from "vite-plugin-html-config"
import Vue from "@vitejs/plugin-vue"
import VueI18n from "@intlify/vite-plugin-vue-i18n"
import Components from "unplugin-vue-components/vite"
import Icons from "unplugin-icons/vite"
import Inspect from "vite-plugin-inspect"
import WindiCSS from "vite-plugin-windicss"
import Checker from "vite-plugin-checker"
import { VitePWA } from "vite-plugin-pwa"
import Pages from "vite-plugin-pages"
import Layouts from "vite-plugin-vue-layouts"
import IconResolver from "unplugin-icons/resolver"
import { FileSystemIconLoader } from "unplugin-icons/loaders"
import * as path from "path"
import { VitePluginFonts } from "vite-plugin-fonts"
import legacy from "@vitejs/plugin-legacy"
const ENV = loadEnv("development", process.cwd())
export default defineConfig({
define: {
// For 'util' polyfill required by dep of '@apidevtools/swagger-parser'
"process.env": {},
},
server: {
port: 3000,
},
preview: {
port: 3000,
},
build: {
sourcemap: true,
emptyOutDir: true,
},
resolve: {
alias: {
"~": path.resolve(__dirname, "./src"),
"@composables": path.resolve(__dirname, "./src/composables"),
"@modules": path.resolve(__dirname, "./src/modules"),
"@components": path.resolve(__dirname, "./src/components"),
"@helpers": path.resolve(__dirname, "./src/helpers"),
"@functional": path.resolve(__dirname, "./src/helpers/functional"),
"@workers": path.resolve(__dirname, "./src/workers"),
stream: "stream-browserify",
util: "util",
},
},
plugins: [
Inspect(), // go to url -> /__inspect
// Checker({
// eslint: {
// lintCommand: "eslint src --ext .ts,.js,.vue --ignore-path .gitignore .",
// },
// overlay: {
// initialIsOpen: true,
// position: "br",
// },
// }),
HtmlConfig({
metas: META_TAGS(ENV),
}),
Vue(),
Pages({
routeStyle: "nuxt",
dirs: "src/pages",
importMode: "async",
// onRoutesGenerated(routes) {
// return generateSitemap({
// routes,
// nuxtStyle: true,
// allowRobots: true,
// hostname: ENV.VITE_BASE_URL,
// })
// },
}),
Layouts({
layoutsDirs: "./src/layouts",
defaultLayout: "default",
}),
VueI18n({
runtimeOnly: false,
compositionOnly: true,
include: [path.resolve(__dirname, "locales")],
}),
WindiCSS(),
Components({
dts: "./src/components.d.ts",
directoryAsNamespace: true,
resolvers: [
IconResolver({
prefix: "icon",
customCollections: ["hopp", "auth", "brands"],
}),
],
types: [
{
from: "vue-tippy",
names: ["Tippy"],
},
],
}),
Icons({
compiler: "vue3",
customCollections: {
hopp: FileSystemIconLoader("./assets/icons"),
auth: FileSystemIconLoader("./assets/icons/auth"),
brands: FileSystemIconLoader("./assets/icons/brands"),
},
}),
VitePWA({
manifest: {
name: APP_INFO.name,
short_name: APP_INFO.name,
description: APP_INFO.shortDescription,
start_url: "/?source=pwa",
background_color: APP_INFO.app.background,
theme_color: APP_INFO.app.background,
icons: [
{
src: "/icon.png",
sizes: "512x512",
type: "image/png",
purpose: "any maskable",
},
{
src: "/logo.svg",
sizes: "48x48 72x72 96x96 128x128 256x256 512x512",
type: "image/svg+xml",
purpose: "any maskable",
},
],
},
registerType: "prompt",
workbox: {
cleanupOutdatedCaches: true,
maximumFileSizeToCacheInBytes: 4194304,
navigateFallbackDenylist: [
/robots.txt/,
/sitemap.xml/,
/discord/,
/telegram/,
/beta/,
/careers/,
/newsletter/,
/twitter/,
/github/,
/announcements/,
],
},
}),
VitePluginFonts({
google: {
families: [
"Inter:wght@400;500;600;700;800",
"Roboto+Mono:wght@400;500",
"Material+Icons",
],
},
}),
legacy({
modernPolyfills: ["es.string.replace-all"],
renderLegacyChunks: false,
}),
],
})