vite.config.ts 1.9 KB

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