vite.config.js 1020 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. import { defineConfig } from 'vite'
  2. import vue from '@vitejs/plugin-vue'
  3. import AutoImport from 'unplugin-auto-import/vite'
  4. import Components from 'unplugin-vue-components/vite'
  5. import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'
  6. import postCssPxToRem from "postcss-pxtorem";
  7. // https://vitejs.dev/config/
  8. // export default defineConfig({
  9. // plugins: [
  10. // vue(),
  11. // Components({
  12. // resolvers: [ElementPlusResolver()]
  13. // }),
  14. // AutoImport({
  15. // resolvers: [ElementPlusResolver()]
  16. // })
  17. // ]
  18. // })
  19. export default defineConfig({
  20. plugins: [
  21. vue(),
  22. Components({
  23. resolvers: [ElementPlusResolver()]
  24. }),
  25. AutoImport({
  26. resolvers: [ElementPlusResolver()]
  27. })
  28. ],
  29. css: {
  30. postcss:
  31. {
  32. plugins:
  33. [postCssPxToRem({
  34. rootValue: 192,
  35. // 1rem,根据 设计稿宽度/10 进行设置
  36. propList: ['*']
  37. // 需要转换的属性,这里选择全部都进行转换
  38. })]
  39. }
  40. }
  41. })