You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.
import {
fileURLToPath ,
URL
} from 'node:url'
import topLevelAwait from 'vite-plugin-top-level-await'
import {
defineConfig
} from 'vite'
import vue from '@vitejs/plugin-vue'
// https://vitejs.dev/config/
export default defineConfig ( {
base : "./" ,
plugins : [
vue ( ) ,
topLevelAwait ( {
promiseExportName : '__tla' ,
promiseImportName : i => ` __tla_ ${ i } `
} )
] ,
build : {
target : [ 'es2020' ]
} ,
resolve : {
alias : {
'@' : fileURLToPath ( new URL ( './src' , import . meta . url ) )
}
} ,
server : {
host : "0.0.0.0" ,
proxy : {
'/api' : {
target : 'http://localhostcommon/api' , // 实际的API服务器地址
changeOrigin : true ,
rewrite : ( path ) => path . replace ( /^\/api/ , '' ) // 如果API地址有前缀, 可以进行转写
}
}
}
} )