vite.config.ts 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. import { fileURLToPath, URL } from 'node:url'
  2. import { defineConfig } from 'vite'
  3. import vue from '@vitejs/plugin-vue'
  4. import vueDevTools from 'vite-plugin-vue-devtools'
  5. import AutoImport from 'unplugin-auto-import/vite'
  6. import Components from 'unplugin-vue-components/vite'
  7. import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'
  8. import Icons from 'unplugin-icons/vite'
  9. import IconsResolver from 'unplugin-icons/resolver'
  10. import VueI18nPlugin from '@intlify/unplugin-vue-i18n/vite';
  11. import path from 'path'
  12. const __dirname = path.dirname(fileURLToPath(import.meta.url));
  13. // https://vite.dev/config/
  14. export default defineConfig({
  15. plugins: [
  16. vue(),
  17. vueDevTools(),
  18. AutoImport({
  19. imports: ['vue'],
  20. resolvers: [
  21. ElementPlusResolver(),
  22. IconsResolver({
  23. prefix: 'Icon',
  24. }),
  25. ],
  26. eslintrc: { enabled: true },
  27. }),
  28. Components({
  29. resolvers: [
  30. ElementPlusResolver(),
  31. IconsResolver({
  32. enabledCollections: ['ep'],
  33. }),
  34. ],
  35. }),
  36. Icons({
  37. autoInstall: true,
  38. }),
  39. ],
  40. build: {
  41. rollupOptions: {
  42. output: {
  43. manualChunks: {
  44. vendor: ['vue', 'axios', 'element-plus'], // 将第三方库单独打包
  45. },
  46. },
  47. },
  48. },
  49. resolve: {
  50. alias: {
  51. '@': fileURLToPath(new URL('./src', import.meta.url))
  52. },
  53. },
  54. })
  55. function kebabCase(text: any) {
  56. throw new Error('Function not implemented.')
  57. }