hjyd的手机端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

58 lines
1.9 KiB

2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
  1. import { defineConfig } from 'vite'
  2. import { resolve } from 'path'
  3. import vue from '@vitejs/plugin-vue'
  4. import autoprefixer from 'autoprefixer'
  5. import postcsspxtoviewport from 'postcss-px-to-viewport'
  6. // https://vitejs.dev/config/
  7. export default defineConfig({
  8. resolve: {
  9. alias: {
  10. '@': resolve(__dirname, 'src'),
  11. cpns: resolve(__dirname, 'src/components'),
  12. },
  13. extensions: ['.js', '.json', '.vue'],
  14. },
  15. server: {
  16. port: 5173,
  17. host: '0.0.0.0',
  18. },
  19. plugins: [vue()],
  20. //配置sass
  21. css: {
  22. preprocessorOptions: {
  23. scss: {
  24. additionalData:
  25. '@import "./src/assets/scss/globalVar.scss";@import "./src/assets/scss/globalMixin.scss";',
  26. },
  27. },
  28. postcss: {
  29. plugins: [
  30. autoprefixer({
  31. overrideBrowserslist: [
  32. 'Android 4.1',
  33. 'iOS 7.1',
  34. 'Chrome > 31',
  35. 'ff > 31',
  36. 'ie >= 8',
  37. ],
  38. }),
  39. postcsspxtoviewport({
  40. unitToConvert: 'px', // 要转化的单位
  41. viewportWidth: 375, // UI设计稿的宽度
  42. unitPrecision: 6, // 转换后的精度,即小数点位数
  43. propList: ['*'], // 指定转换的css属性的单位,*代表全部css属性的单位都进行转换
  44. viewportUnit: 'vw', // 指定需要转换成的视窗单位,默认vw
  45. fontViewportUnit: 'vw', // 指定字体需要转换成的视窗单位,默认vw
  46. selectorBlackList: ['ignore-'], // 指定不转换为视窗单位的类名,
  47. minPixelValue: 1, // 默认值1,小于或等于1px则不进行转换
  48. mediaQuery: true, // 是否在媒体查询的css代码中也进行转换,默认false
  49. replace: true, // 是否转换后直接更换属性值
  50. // exclude: [/node_modules/], // 设置忽略文件,用正则做目录名匹配
  51. exclude: [],
  52. landscape: false, // 是否处理横屏情况
  53. }),
  54. ],
  55. },
  56. },
  57. })