vite.config.ts 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. import { defineConfig } from 'vite';
  2. import vue from '@vitejs/plugin-vue';
  3. import { FileSystemIconLoader } from 'unplugin-icons/loaders';
  4. import Icons from 'unplugin-icons/vite';
  5. import IconResolver from 'unplugin-icons/resolver';
  6. import Components from 'unplugin-vue-components/vite';
  7. import WindiCSS from 'vite-plugin-windicss';
  8. import Pages from 'vite-plugin-pages';
  9. import Layouts from 'vite-plugin-vue-layouts';
  10. import path from 'path';
  11. // https://vitejs.dev/config/
  12. export default defineConfig({
  13. envDir: path.resolve(__dirname, '../../'),
  14. server: {
  15. port: 3100,
  16. },
  17. resolve: {
  18. alias: {
  19. '~': path.resolve(__dirname, '../hoppscotch-sh-admin/src'),
  20. '@modules': path.resolve(__dirname, '../hoppscotch-sh-admin/src/modules'),
  21. },
  22. },
  23. plugins: [
  24. vue(),
  25. Pages({
  26. dirs: './src/pages',
  27. routeStyle: 'nuxt',
  28. }),
  29. Layouts({
  30. defaultLayout: 'default',
  31. layoutsDirs: 'src/layouts',
  32. }),
  33. WindiCSS({
  34. root: path.resolve(__dirname),
  35. }),
  36. Components({
  37. dts: './src/components.d.ts',
  38. dirs: ['./src/components'],
  39. directoryAsNamespace: true,
  40. resolvers: [
  41. IconResolver({
  42. prefix: 'icon',
  43. customCollections: ['auth'],
  44. }),
  45. (compName: string) => {
  46. if (compName.startsWith('Hopp'))
  47. return { name: compName, from: '@hoppscotch/ui' };
  48. else return undefined;
  49. },
  50. ],
  51. types: [
  52. {
  53. from: 'vue-tippy',
  54. names: ['Tippy'],
  55. },
  56. ],
  57. }),
  58. Icons({
  59. compiler: 'vue3',
  60. customCollections: {
  61. auth: FileSystemIconLoader('../hoppscotch-sh-admin/assets/icons/auth'),
  62. },
  63. }),
  64. ],
  65. });