vite.config.ts 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. import { defineConfig } from 'vite'
  2. import vue from '@vitejs/plugin-vue'
  3. import path from 'path'
  4. import WindiCss from 'vite-plugin-windicss';
  5. import AutoImport from 'unplugin-auto-import/vite'
  6. import Components from 'unplugin-vue-components/vite'
  7. import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'
  8. // https://vitejs.dev/config/
  9. export default defineConfig({
  10. // base:'/app/xdjx/',
  11. // base: '/app/xdjy/',
  12. // base: '/app/xdhq/',
  13. resolve: {
  14. alias: {
  15. '~': `${path.resolve(__dirname, 'src')}`,
  16. '~/': `${path.resolve(__dirname, 'src/')}`,
  17. '~components': `${path.resolve(__dirname, 'src/components')}`,
  18. '@': `${path.resolve(__dirname, 'src')}`,
  19. },
  20. },
  21. css: {
  22. preprocessorOptions: {
  23. scss: {
  24. additionalData: `@use "~/styles/element/index.scss" as *;`,
  25. },
  26. },
  27. },
  28. plugins: [
  29. vue(),
  30. WindiCss(),
  31. AutoImport({
  32. resolvers: [ElementPlusResolver()],
  33. }),
  34. Components({
  35. resolvers: [ElementPlusResolver()],
  36. }),
  37. ],
  38. build: {
  39. // target: 'modules'
  40. target: 'esnext',
  41. rollupOptions: {
  42. output: {
  43. manualChunks:{
  44. lodash: ['lodash-es'],
  45. echarts:['echarts'],
  46. axios:['axios']
  47. }
  48. }
  49. }
  50. },
  51. })