vite.config.js 994 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  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. }
  20. }
  21. },
  22. plugins: [
  23. vue(),
  24. createSvgIconsPlugin({
  25. iconDirs: [path.resolve(process.cwd(), 'src/assets/icons')],
  26. symbolId: 'icon-[dir]-[name]',
  27. }),
  28. AutoImport({
  29. resolvers: [ElementPlusResolver({
  30. importStyle: "sass"
  31. })]
  32. }),
  33. Components({
  34. resolvers: [ElementPlusResolver({
  35. importStyle: "sass"
  36. })]
  37. })
  38. ]
  39. })