vite.config.ts 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. import { fileURLToPath, URL } from 'node:url'
  2. import { defineConfig } from 'vite'
  3. import { createSvgIconsPlugin } from '@digitalacorn/vite-plugin-svg-icons'
  4. import vue from '@vitejs/plugin-vue'
  5. import vueJsx from '@vitejs/plugin-vue-jsx'
  6. import VueDevTools from 'vite-plugin-vue-devtools'
  7. import path from 'path'
  8. import AutoImport from 'unplugin-auto-import/vite'
  9. import Components from 'unplugin-vue-components/vite'
  10. import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'
  11. // https://vitejs.dev/config/
  12. export default defineConfig({
  13. base: './',
  14. plugins: [
  15. vue(),
  16. vueJsx(),
  17. VueDevTools(),
  18. createSvgIconsPlugin({
  19. iconDirs: [path.resolve(process.cwd(), 'src/assets/svgs')],
  20. symbolId: 'icon-[dir]-[name]',
  21. svgoOptions: true,
  22. replaceStrokeWithCurrentColor: false
  23. }),
  24. AutoImport({
  25. resolvers: [ElementPlusResolver()],
  26. }),
  27. Components({
  28. resolvers: [ElementPlusResolver()],
  29. }),
  30. ],
  31. resolve: {
  32. alias: {
  33. '@': fileURLToPath(new URL('./src', import.meta.url))
  34. },
  35. extensions: ['.mjs', '.js', '.ts', '.jsx', '.tsx', '.json', '.vue']
  36. },
  37. css: {
  38. preprocessorOptions: {
  39. scss: {
  40. additionalData: `
  41. @import "@/assets/styles/mixins.scss";
  42. @import "@/assets/styles/variables.scss";`
  43. }
  44. }
  45. },
  46. server: {
  47. host: '0.0.0.0'
  48. },
  49. })