vite.config.ts 917 B

123456789101112131415161718192021222324252627282930
  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. plugins: [
  9. vue(),
  10. WindiCSS(),
  11. styleImport({
  12. resolves: [VantResolve()]
  13. })
  14. ],
  15. resolve: {
  16. alias: {
  17. '@': path.resolve(__dirname, 'src'), //使用@来代表src目录
  18. components: path.resolve(__dirname, 'src/components'),
  19. styles: path.resolve(__dirname, 'src/styles'),
  20. plugins: path.resolve(__dirname, 'src/plugins'),
  21. views: path.resolve(__dirname, 'src/views'),
  22. layouts: path.resolve(__dirname, 'src/layouts'),
  23. utils: path.resolve(__dirname, 'src/utils'),
  24. apis: path.resolve(__dirname, 'src/apis'),
  25. dirs: path.resolve(__dirname, 'src/directives')
  26. }
  27. }
  28. })