-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvite.config.js
37 lines (36 loc) · 923 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
import { defineConfig, loadEnv } from 'vite'
import vue from '@vitejs/plugin-vue'
import path from 'path'
import topLevelAwait from 'vite-plugin-top-level-await';
// https://vitejs.dev/config/
export default ({ mode }) => {
const env = loadEnv(mode, process.cwd());
return defineConfig({
base: '/',
build: {
sourcemap: false
},
server: {
open: true, // 运行后自动打开浏览器
port: env.VITE_APP_PORT, // 挂载端口
proxy: {
'/api': {
target: env.VITE_APP_API_BASEURL,
ws: true,
rewrite: (path) => path.replace(/^\/api/, '')
}
}
},
plugins: [
vue(),
topLevelAwait()
],
resolve: {
alias: {
'vue-i18n': 'vue-i18n/dist/vue-i18n.cjs.js',
'@': path.resolve(__dirname, 'src')
},
extensions: ['.mjs', '.js', '.ts', '.jsx', '.tsx', '.json', '.vue'],
},
})
}