vite.config.js 1.1 KB

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