forked from dandi/dandi-archive
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvite.config.ts
59 lines (52 loc) · 1.45 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
import { execSync } from 'node:child_process'
import { fileURLToPath, URL } from 'node:url'
import { defineConfig } from 'vite'
import legacy from '@vitejs/plugin-legacy'
import vue2 from '@vitejs/plugin-vue2'
import { nodePolyfills } from 'vite-plugin-node-polyfills'
import { VuetifyResolver } from 'unplugin-vue-components/resolvers';
import Components from 'unplugin-vue-components/vite';
function getVersion() {
// Try to get the version via `git` if available; otherwise fall back on
// the COMMIT_REF environment variable provided by Netlify's build
// environment; if that is missing, report "unknown" as the version.
try {
return execSync('git describe --tags').toString();
} catch (err) {
return process.env.COMMIT_REF ? process.env.COMMIT_REF : 'unknown';
}
}
function getGitRevision() {
try {
return execSync('git rev-parse HEAD').toString();
} catch (err) {
return '';
}
}
process.env.VITE_APP_VERSION = getVersion();
process.env.VITE_APP_GIT_REVISION = getGitRevision();
// https://vitejs.dev/config/
export default defineConfig({
server: {
port: 8085,
},
plugins: [
vue2(),
legacy({
targets: ['ie >= 11'],
additionalLegacyPolyfills: ['regenerator-runtime/runtime']
}),
nodePolyfills(),
Components({
resolvers: [
// Vuetify
VuetifyResolver(),
],
}),
],
resolve: {
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url))
}
}
})