-
Notifications
You must be signed in to change notification settings - Fork 0
/
vite.config.ts
60 lines (57 loc) · 1.62 KB
/
vite.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
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import path from 'path'
import dotenv from 'dotenv'
const DRIVE_LETTER_REGEX = /^[a-z]:/i
const INVALID_CHAR_REGEX = /[\x00-\x1F\x7F<>*#"{}|^[\]`;?:&=+$,]/g
process.env.VITE_APP_VERSION = process.env.npm_package_version
dotenv.config()
// https://vitejs.dev/config/
export default defineConfig({
plugins: [
{
name: 'html-transform',
transformIndexHtml(html) {
return html.replace(
/<title>(.*?)<\/title>/,
`<title>${process.env.VITE_APP_TITLE}</title>`
)
}
},
vue()
],
base: process.env.VITE_APP_BASE,
build: {
outDir: 'docs',
assetsDir: 'assets',
assetsInlineLimit: 4096,
rollupOptions: {
output: {
manualChunks(id) {
if (id.includes('node_modules')) {
const modules = id.toString().split('node_modules/.pnpm/')[1].split('/')[0].toString()
if (modules.indexOf('firebase') > -1) return 'firebase'
if (modules.indexOf('fortawesome') > -1) return 'fortawesome'
// if (modules.indexOf('chart.js') > -1) return 'chartjs'
return 'vendor'
}
},
sanitizeFileName(name) {
const match = DRIVE_LETTER_REGEX.exec(name)
const driveLetter = match ? match[0] : ''
return driveLetter + name.slice(driveLetter.length).replace(INVALID_CHAR_REGEX, "")
}
}
}
},
server: {
port: 8000,
host: '0.0.0.0'
},
resolve: {
alias: {
"vue-i18n": "vue-i18n/dist/vue-i18n.cjs.js",
"@": path.resolve(__dirname, 'src/')
}
}
})