39 lines
816 B
JavaScript
39 lines
816 B
JavaScript
|
|
import { defineConfig } from 'vite'
|
||
|
|
import uni from '@dcloudio/vite-plugin-uni'
|
||
|
|
import path from 'path'
|
||
|
|
import { fileURLToPath } from 'url'
|
||
|
|
|
||
|
|
const __dirname = path.dirname(fileURLToPath(import.meta.url))
|
||
|
|
|
||
|
|
export default defineConfig({
|
||
|
|
plugins: [uni()],
|
||
|
|
resolve: {
|
||
|
|
alias: {
|
||
|
|
'@': path.resolve(__dirname, 'src')
|
||
|
|
}
|
||
|
|
},
|
||
|
|
css: {
|
||
|
|
preprocessorOptions: {
|
||
|
|
scss: {
|
||
|
|
additionalData: `@import "uview-plus/theme.scss";`
|
||
|
|
}
|
||
|
|
}
|
||
|
|
},
|
||
|
|
server: {
|
||
|
|
port: 20003, // 用户界面端口
|
||
|
|
host: '0.0.0.0', // 允许外部访问
|
||
|
|
open: true,
|
||
|
|
strictPort: false,
|
||
|
|
proxy: {
|
||
|
|
'/api': {
|
||
|
|
target: 'http://localhost:8081', // 后端服务端口8081
|
||
|
|
changeOrigin: true,
|
||
|
|
secure: false
|
||
|
|
}
|
||
|
|
}
|
||
|
|
},
|
||
|
|
optimizeDeps: {
|
||
|
|
include: ['uview-plus']
|
||
|
|
}
|
||
|
|
})
|