vite.config.mjs 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. // Plugins
  2. import Components from 'unplugin-vue-components/vite'
  3. import Vue from '@vitejs/plugin-vue'
  4. import Vuetify, { transformAssetUrls } from 'vite-plugin-vuetify'
  5. // import ViteFonts from 'unplugin-fonts/vite'
  6. import { createSvgIconsPlugin } from 'vite-plugin-svg-icons'
  7. import path from 'path'
  8. // Utilities
  9. import { defineConfig } from 'vite'
  10. import { fileURLToPath, URL } from 'node:url'
  11. // https://vitejs.dev/config/
  12. export default defineConfig({
  13. plugins: [
  14. Vue({
  15. template: { transformAssetUrls }
  16. }),
  17. // https://github.com/vuetifyjs/vuetify-loader/tree/master/packages/vite-plugin#readme
  18. Vuetify(),
  19. Components({
  20. dts: true,
  21. resolvers: [
  22. (name) => {
  23. if (name.startsWith('Base')) {
  24. return { importName: name.slice(4), path: `@/components/CtVuetify/${name}.vue` }
  25. }
  26. },
  27. ]
  28. }),
  29. createSvgIconsPlugin({
  30. iconDirs: [path.resolve(process.cwd(), 'src/assets/svg')],
  31. // symbolId: 'icon-[dir]-[name]',
  32. })
  33. // ViteFonts({
  34. // google: {
  35. // // families: [{
  36. // // name: 'Roboto',
  37. // // styles: 'wght@100;300;400;500;700;900',
  38. // // }],
  39. // },
  40. // }),
  41. ],
  42. define: { 'process.env': {} },
  43. resolve: {
  44. alias: {
  45. '@': fileURLToPath(new URL('./src', import.meta.url))
  46. },
  47. extensions: [
  48. '.js',
  49. '.json',
  50. '.jsx',
  51. '.mjs',
  52. '.ts',
  53. '.tsx',
  54. '.vue',
  55. ],
  56. },
  57. server: {
  58. port: 3000
  59. },
  60. })