vite.config.js 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. import path from 'path'
  2. import { defineConfig } from 'vite'
  3. import vue from '@vitejs/plugin-vue'
  4. import AutoImport from 'unplugin-auto-import/vite'
  5. import Components from 'unplugin-vue-components/vite'
  6. import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'
  7. import { createSvgIconsPlugin } from 'vite-plugin-svg-icons'
  8. // https://vitejs.dev/config/
  9. export default defineConfig({
  10. resolve: {
  11. alias: {
  12. '~/': `${path.resolve(__dirname, 'src')}/`
  13. }
  14. },
  15. css: {
  16. preprocessorOptions: {
  17. scss: {
  18. additionalData: `@use "~/styles/element/index.scss" as *;`
  19. // `@import "~/styles/index.scss";`
  20. }
  21. }
  22. },
  23. plugins: [
  24. vue(),
  25. createSvgIconsPlugin({
  26. iconDirs: [path.resolve(process.cwd(), 'src/assets/icons')],
  27. symbolId: 'icon-[dir]-[name]',
  28. }),
  29. AutoImport({
  30. resolvers: [ElementPlusResolver({
  31. importStyle: "sass"
  32. })]
  33. }),
  34. Components({
  35. resolvers: [ElementPlusResolver({
  36. importStyle: "sass"
  37. })]
  38. })
  39. ]
  40. })