设置开发环境

master
liuyx 2 years ago
parent 5bdb6bb090
commit 588e6b562e

@ -0,0 +1 @@
VITE_BASIC_URL = http://127.0.0.1:4523/m1/1852803-0-default

@ -1,21 +1,24 @@
import { defineConfig } from 'vite' import { defineConfig, loadEnv } from 'vite'
import vue from '@vitejs/plugin-vue' import vue from '@vitejs/plugin-vue'
import path from 'path' import path from 'path'
// https://vitejs.dev/config/ // https://vitejs.dev/config/
export default defineConfig({ export default defineConfig(({ mode }) => {
plugins: [vue()], const config = loadEnv(mode, './')
resolve: { return {
alias: { plugins: [vue()],
'@': path.resolve(__dirname, 'src') // 利用@代替src resolve: {
} alias: {
}, '@': path.resolve(__dirname, 'src') // 利用@代替src
server: { }
proxy: { },
'/api': { server: {
target: 'http://localhost:3000', proxy: {
changeOrigin: true, '/api': {
rewrite: (path) => path.replace(/^\/api/, '') target: config.VITE_BASIC_URL,
changeOrigin: true,
rewrite: (path) => path.replace(/^\/api/, '')
}
} }
} }
} }

Loading…
Cancel
Save