vite.config.js 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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. export default defineConfig({
  8. plugins: [
  9. vue(),
  10. Components({
  11. resolvers: [ElementPlusResolver()]
  12. }),
  13. AutoImport({
  14. resolvers: [ElementPlusResolver()]
  15. }),
  16. ],
  17. css: {
  18. postcss:
  19. {
  20. plugins:
  21. [postCssPxToRem({
  22. rootValue: 192,
  23. // 1rem,根据 设计稿宽度/10 进行设置
  24. propList: ['*']
  25. // 需要转换的属性,这里选择全部都进行转换
  26. })]
  27. }
  28. },
  29. configureWebpack: (config) => {
  30. console.log("config");
  31. config.module.rules.push(
  32. {
  33. test: path.resolve(__dirname, 'node_modules/leader-line/'),
  34. use: [{
  35. loader: 'skeleton-loader',
  36. options: { procedure: content => `${content}export default LeaderLine` }
  37. }]
  38. }
  39. )
  40. },
  41. })