-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
vite.config.js
40 lines (38 loc) · 946 Bytes
/
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
import path from 'path'
import pkg from './package.json'
import legacy from '@vitejs/plugin-legacy'
import { createHtmlPlugin } from 'vite-plugin-html'
import { defineConfig } from 'vite'
const r = p => path.resolve(__dirname, './src', p)
// eslint-disable-next-line no-unused-vars
export default defineConfig(({ command, mode }) => {
return {
server: { port: 3000 },
preview: { port: 8080 },
resolve: {
alias: {
'@': r('.')
}
},
plugins: [
legacy({
targets: ['defaults', 'not IE 10'],
additionalLegacyPolyfills: ['regenerator-runtime/runtime']
}),
createHtmlPlugin({
minify: true,
entry: '/src/main.js',
template: 'index.html',
inject: {
data: {
appVersion: `v${pkg.version}`
}
}
})
],
proxy: {},
define: {
__APP_VERSION__: JSON.stringify(`v${pkg.version}`)
}
}
})