vite.config.js 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. import { fileURLToPath, URL } from 'node:url'
  2. import { defineConfig } from 'vite'
  3. import vue from '@vitejs/plugin-vue'
  4. import viteImagemin from 'vite-plugin-imagemin'
  5. // https://vitejs.dev/config/
  6. export default defineConfig({
  7. server: {
  8. host: '0.0.0.0'
  9. },
  10. plugins: [
  11. vue(),
  12. viteImagemin({
  13. gifsicle: {
  14. optimizationLevel: 7,
  15. interlaced: false
  16. },
  17. optipng: false,
  18. mozjpeg: {
  19. quality: 20
  20. },
  21. pngquant: {
  22. quality: [0.5, 0.9],
  23. speed: 1
  24. },
  25. svgo: {
  26. plugins: [
  27. {
  28. name: 'removeViewBox'
  29. },
  30. {
  31. name: 'removeEmptyAttrs',
  32. active: false
  33. }
  34. ]
  35. }
  36. })
  37. ],
  38. resolve: {
  39. alias: {
  40. '@': fileURLToPath(new URL('./src', import.meta.url))
  41. }
  42. },
  43. css: {
  44. preprocessorOptions: {
  45. less: {
  46. javascriptEnabled: true,
  47. additionalData: '@import "@/styles/common.less";'
  48. }
  49. }
  50. }
  51. })