vite.config.js 979 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. import vue from '@vitejs/plugin-vue'
  2. import { defineConfig } from 'vite'
  3. import path from 'path'
  4. // https://vitejs.dev/config/
  5. export default defineConfig(({ command, mode }) => {
  6. return {
  7. // 项目插件
  8. plugins: [
  9. vue(),
  10. ],
  11. // 基础配置
  12. base: './',
  13. publicDir: 'public',
  14. resolve: {
  15. alias: {
  16. '@': path.resolve(__dirname, 'src'),
  17. },
  18. },
  19. css: {
  20. preprocessorOptions: {
  21. less: {
  22. modifyVars: {
  23. '@border-color-base': '#dce3e8',
  24. },
  25. javascriptEnabled: true,
  26. },
  27. },
  28. },
  29. build: {
  30. outDir: 'dist',
  31. assetsDir: 'assets',
  32. assetsInlineLimit: 4096,
  33. cssCodeSplit: true,
  34. brotliSize: false,
  35. sourcemap: false,
  36. minify: 'terser',
  37. terserOptions: {
  38. compress: {
  39. // 生产环境去除console及debug
  40. drop_console: false,
  41. drop_debugger: true,
  42. },
  43. },
  44. },
  45. }
  46. })