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.

49 lines
1.3 KiB

2 years ago
2 years ago
2 years ago
2 years ago
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 postCssPxToRem from 'postcss-pxtorem'
  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. host: '0.0.0.0',
  17. },
  18. plugins: [vue()],
  19. //配置sass
  20. css: {
  21. preprocessorOptions: {
  22. scss: {
  23. additionalData:
  24. '@import "./src/assets/scss/globalVar.scss";@import "./src/assets/scss/globalMixin.scss";',
  25. },
  26. },
  27. postcss: {
  28. plugins: [
  29. autoprefixer({
  30. overrideBrowserslist: [
  31. 'Android 4.1',
  32. 'iOS 7.1',
  33. 'Chrome > 31',
  34. 'ff > 31',
  35. 'ie >= 8',
  36. ],
  37. }),
  38. postCssPxToRem({
  39. // 自适应,px>rem转换
  40. rootValue: 225, // 75表示750设计稿,37.5表示375设计稿
  41. propList: ['*'], // 需要转换的属性,这里选择全部都进行转换
  42. selectorBlackList: ['norem'], // 过滤掉norem-开头的class,不进行rem转换
  43. unitPrecision: 5,
  44. }),
  45. ],
  46. },
  47. },
  48. })