123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- import { defineConfig, loadEnv } from 'vite'
- import vue from '@vitejs/plugin-vue'
- import vueJsx from '@vitejs/plugin-vue-jsx'
- import path from 'path'
- import { fileURLToPath } from 'url'
- const __dirname = path.dirname(fileURLToPath(import.meta.url))
- function resolve(dir) {
- return path.join(__dirname, dir)
- }
- export default defineConfig(({ command, mode }) => {
- // 加载env文件
- const env = loadEnv(mode, process.cwd(), '')
-
- return {
- plugins: [
- vue(),
- vueJsx()
- ],
- resolve: {
- alias: {
- '@': resolve('src'),
- '@api': resolve('src/api'),
- '@assets': resolve('src/assets'),
- '@layouts': resolve('src/layouts'),
- '@static': resolve('src/static'),
- '@components': resolve('src/components'),
- '@router': resolve('src/router'),
- '@utils': resolve('src/utils'),
- '@store': resolve('src/store'),
- '@views': resolve('src/views')
- },
- extensions: ['.js', '.jsx', '.ts', '.tsx', '.json', '.vue']
- },
- server: {
- port: 8003,
- proxy: {
- '/WebSocketConfig/': {
- target: 'ws://test.com',
- changeOrigin: true,
- ws: true,
- },
- '/api/': {
- target: 'http://test.com',
- changeOrigin: true,
- ws: false,
- }
- }
- },
- base: '/',
- }
- })
|