vite.config.ts 912 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. import { defineConfig } from 'vite'
  2. import vue from '@vitejs/plugin-vue'
  3. import { resolve } from 'path'
  4. import topLevelAwait from 'vite-plugin-top-level-await'
  5. import { createSvgIconsPlugin } from 'vite-plugin-svg-icons'
  6. // https://vitejs.dev/config/
  7. export default defineConfig({
  8. plugins: [
  9. vue(),
  10. topLevelAwait({
  11. promiseExportName: '__tla',
  12. promiseImportName: i => `__tla_${i}`
  13. }),
  14. createSvgIconsPlugin({
  15. iconDirs: [resolve(process.cwd(), 'src/assets/svg')],
  16. })
  17. ],
  18. resolve: {
  19. alias: {
  20. '@': resolve(__dirname, './src/'),
  21. }
  22. },
  23. css: {
  24. preprocessorOptions: {
  25. scss: {
  26. additionalData: ` @use './src/assets/style/bem.scss' as *;`
  27. }
  28. },
  29. },
  30. server: {
  31. hmr: true,
  32. port: 9074,
  33. open: true,
  34. proxy: {
  35. "/appServer": {
  36. target: "http://127.0.0.1:9075",
  37. changeOrigin: true,
  38. },
  39. }
  40. },
  41. })