vite.config.js 546 B

12345678910111213141516171819202122
  1. import { defineConfig } from 'vite'
  2. import vue from '@vitejs/plugin-vue'
  3. import path from 'path'
  4. // https://vitejs.dev/config/
  5. export default defineConfig({
  6. plugins: [vue()],
  7. // vue 引入 src 目录
  8. resolve:{
  9. alias:{
  10. '@': path.resolve(__dirname, './src')
  11. }
  12. },
  13. server: {
  14. host: '0.0.0.0', // 监听所有地址,允许外部访问
  15. port: 18889, // 指定端口号
  16. // 其他配置项...
  17. },
  18. define: {
  19. 'process.env.BASE_URL': JSON.stringify(process.env.BASE_URL || '/')
  20. }
  21. })