vite.config.ts 949 B

123456789101112131415161718192021222324252627282930313233
  1. import { defineConfig } from 'vite'
  2. import vue from '@vitejs/plugin-vue'
  3. import styleImport, { VantResolve } from 'vite-plugin-style-import'
  4. import WindiCSS from 'vite-plugin-windicss'
  5. import * as path from 'path'
  6. // https://vitejs.dev/config/
  7. export default defineConfig({
  8. server: {
  9. host: true
  10. },
  11. plugins: [
  12. vue(),
  13. WindiCSS(),
  14. styleImport({
  15. resolves: [VantResolve()]
  16. })
  17. ],
  18. resolve: {
  19. alias: {
  20. '@': path.resolve(__dirname, 'src'), //使用@来代表src目录
  21. components: path.resolve(__dirname, 'src/components'),
  22. styles: path.resolve(__dirname, 'src/styles'),
  23. plugins: path.resolve(__dirname, 'src/plugins'),
  24. views: path.resolve(__dirname, 'src/views'),
  25. layouts: path.resolve(__dirname, 'src/layouts'),
  26. utils: path.resolve(__dirname, 'src/utils'),
  27. apis: path.resolve(__dirname, 'src/apis'),
  28. dirs: path.resolve(__dirname, 'src/directives')
  29. }
  30. }
  31. })