vite.config.ts 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. import { defineConfig } from 'vite'
  2. import vue from '@vitejs/plugin-vue'
  3. import { createSvgIconsPlugin } from 'vite-plugin-svg-icons'
  4. import path from 'path'
  5. export default defineConfig({
  6. publicDir: 'static',
  7. plugins: [
  8. vue(),
  9. createSvgIconsPlugin({
  10. iconDirs: [path.resolve(process.cwd(), 'src/icons/svg')],
  11. symbolId: 'icon-[name]'
  12. })
  13. ],
  14. define: {
  15. __VUE_PROD_HYDRATION_MISMATCH_DETAILS__: false
  16. },
  17. resolve: {
  18. extensions: ['.mjs', '.js', '.ts', '.jsx', '.tsx', '.json', '.vue'],
  19. alias: {
  20. '@': path.resolve(__dirname, './src'),
  21. 'imgs': path.resolve(__dirname, './src/assets/imgs')
  22. }
  23. },
  24. css: {
  25. preprocessorOptions: {
  26. scss: {
  27. additionalData: `@use "@/styles/variables.scss" as *;`
  28. }
  29. }
  30. },
  31. server: {
  32. port: 8080,
  33. proxy: {
  34. '/tenant': {
  35. target: 'http://114.104.160.118:18001/',
  36. changeOrigin: true
  37. },
  38. '/admin': {
  39. target: 'http://114.104.160.118:18001/',
  40. changeOrigin: true
  41. },
  42. '/external': {
  43. target: 'http://114.104.160.118:18001/',
  44. changeOrigin: true
  45. }
  46. }
  47. },
  48. build: {
  49. outDir: 'dist',
  50. chunkSizeWarningLimit: 3000,
  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. })