-
Notifications
You must be signed in to change notification settings - Fork 56
Expand file tree
/
Copy pathvite.config.js
More file actions
50 lines (48 loc) · 1.21 KB
/
vite.config.js
File metadata and controls
50 lines (48 loc) · 1.21 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
import { defineConfig } from 'vite'
import { resolve } from 'path'
import vue from '@vitejs/plugin-vue'
import cesium from 'vite-plugin-cesium'
import babel from 'vite-babel-plugin'
const { geoserverHost } = require('./public/setting')
// https://vitejs.dev/config/
export default defineConfig(({ mode }) => {
const isDev = mode === 'development'
const proxyHost = !isDev ? 'http://localhost:9999/' : geoserverHost
return {
plugins: [vue(), cesium(), babel()],
base: './',
sourcemap: isDev,
resolve: {
alias: {
'@': resolve(__dirname, 'src'),
'~': resolve(__dirname, 'public')
}
// extensions: ['.mjs', '.js', '.ts', '.jsx', '.tsx', '.json', '.vue']
},
optimizeDeps: {
// include: ['axios'],
},
build: {
target: 'modules',
outDir: 'dist',
assetsDir: 'assets',
minify: 'terser' // terser
},
server: {
cors: true,
open: false,
host: '0.0.0.0',
port: 9999,
proxy: {
'/geoserver': {
target: proxyHost, // proxy site
changeOrigin: true
},
'/terrain': {
target: proxyHost, // proxy site
changeOrigin: true
}
}
}
}
})