| 1234567891011121314151617181920212223242526272829303132333435363738 |
- import { fileURLToPath, URL } from 'node:url'
- import path from 'node:path'
- import { defineConfig, loadEnv } from 'vite'
- import vue from '@vitejs/plugin-vue'
- import vueDevTools from 'vite-plugin-vue-devtools'
- const __dirname = path.dirname(fileURLToPath(import.meta.url))
- // https://vite.dev/config/
- export default defineConfig(({ command, mode }) => {
- const env = loadEnv(mode,process.cwd(),'');
- const port = parseInt(env.VITE_APP_PORT) || 5173
- const apiTarget = env.VITE_APP_API_BASEURL || 'http://localhost:3000'
- return {
- plugins: [
- vue(),
- vueDevTools(),
- ],
- resolve: {
- alias: {
- '@': path.resolve(__dirname, './src')
- },
- },
- server: {
- port: port,
- strictPort: true,
- proxy: {
- "/api": {
- target:apiTarget,
- changeOrigin:true
- }
- }
- }
- }
- })
|