vite.config.ts 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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 Unfonts from "unplugin-fonts/vite";
  6. import IconResolver from 'unplugin-icons/resolver';
  7. import Components from 'unplugin-vue-components/vite';
  8. import WindiCSS from 'vite-plugin-windicss';
  9. import Pages from 'vite-plugin-pages';
  10. import Layouts from 'vite-plugin-vue-layouts';
  11. import VueI18n from '@intlify/vite-plugin-vue-i18n';
  12. import path from 'path';
  13. // https://vitejs.dev/config/
  14. export default defineConfig({
  15. envDir: path.resolve(__dirname, '../../'),
  16. server: {
  17. port: 3100,
  18. },
  19. resolve: {
  20. alias: {
  21. '~': path.resolve(__dirname, '../hoppscotch-sh-admin/src'),
  22. '@modules': path.resolve(__dirname, '../hoppscotch-sh-admin/src/modules'),
  23. },
  24. },
  25. plugins: [
  26. vue(),
  27. Pages({
  28. dirs: './src/pages',
  29. routeStyle: 'nuxt',
  30. }),
  31. Layouts({
  32. defaultLayout: 'default',
  33. layoutsDirs: 'src/layouts',
  34. }),
  35. VueI18n({
  36. runtimeOnly: false,
  37. compositionOnly: true,
  38. include: [path.resolve(__dirname, 'locales')],
  39. }),
  40. WindiCSS({
  41. root: path.resolve(__dirname),
  42. }),
  43. Components({
  44. dts: './src/components.d.ts',
  45. dirs: ['./src/components'],
  46. directoryAsNamespace: true,
  47. resolvers: [
  48. IconResolver({
  49. prefix: 'icon',
  50. customCollections: ['auth'],
  51. }),
  52. (compName: string) => {
  53. if (compName.startsWith('Hopp'))
  54. return { name: compName, from: '@hoppscotch/ui' };
  55. else return undefined;
  56. },
  57. ],
  58. types: [
  59. {
  60. from: 'vue-tippy',
  61. names: ['Tippy'],
  62. },
  63. ],
  64. }),
  65. Icons({
  66. compiler: 'vue3',
  67. customCollections: {
  68. auth: FileSystemIconLoader('../hoppscotch-sh-admin/assets/icons/auth'),
  69. },
  70. }),
  71. Unfonts({
  72. fontsource: {
  73. families: [
  74. {
  75. name: "Inter Variable",
  76. variables: ["variable-full"],
  77. },
  78. {
  79. name: "Material Symbols Rounded Variable",
  80. variables: ["variable-full"],
  81. },
  82. {
  83. name: "Roboto Mono Variable",
  84. variables: ["variable-full"],
  85. },
  86. ],
  87. },
  88. }),
  89. ],
  90. });