vite.config.js 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /*******
  2. * @Author: gcz saadmin@126.com
  3. * @Date: 2025-09-01 11:38:45
  4. * @LastEditors: gcz saadmin@126.com
  5. * @LastEditTime: 2025-09-01 13:58:23
  6. * @FilePath: \claudetest\vite.config.js
  7. * @Description:
  8. * @
  9. */
  10. import { defineConfig } from 'vite'
  11. import { resolve } from 'path'
  12. import vue from '@vitejs/plugin-vue'
  13. // https://vitejs.dev/config/
  14. export default defineConfig({
  15. plugins: [vue()],
  16. resolve: {
  17. alias: {
  18. '@': resolve(__dirname, 'src'),
  19. '@assets': resolve(__dirname, 'src/assets'),
  20. '@components': resolve(__dirname, 'src/components'),
  21. '@views': resolve(__dirname, 'src/views'),
  22. '@pages': resolve(__dirname, 'src/pages'),
  23. '@router': resolve(__dirname, 'src/router'),
  24. '@stores': resolve(__dirname, 'src/stores'),
  25. '@utils': resolve(__dirname, 'src/utils'),
  26. '@api': resolve(__dirname, 'src/api'),
  27. '@styles': resolve(__dirname, 'src/styles')
  28. }
  29. },
  30. css: {
  31. preprocessorOptions: {
  32. scss: {
  33. additionalData: `@use "@/styles/variables.scss" as *;`
  34. }
  35. }
  36. },
  37. server: {
  38. host: '0.0.0.0',
  39. // port: 3000,
  40. open: true,
  41. proxy: {
  42. '/api': {
  43. target: 'http://localhost:8080',
  44. changeOrigin: true,
  45. rewrite: (path) => path.replace(/^\/api/, '')
  46. }
  47. }
  48. },
  49. build: {
  50. outDir: 'dist',
  51. assetsDir: 'static',
  52. rollupOptions: {
  53. output: {
  54. chunkFileNames: 'static/js/[name]-[hash].js',
  55. entryFileNames: 'static/js/[name]-[hash].js',
  56. assetFileNames: 'static/[ext]/[name]-[hash].[ext]'
  57. }
  58. }
  59. }
  60. })