vite.config.mts 840 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. import { defineConfig } from 'vite';
  2. import { resolve } from 'node:path';
  3. import VueMacros from 'unplugin-vue-macros/vite'
  4. import vue from '@vitejs/plugin-vue';
  5. import vueJsx from '@vitejs/plugin-vue-jsx';
  6. const externals = ['vue'];
  7. export default defineConfig({
  8. plugins: [
  9. VueMacros({
  10. plugins: {
  11. vue: vue(),
  12. vueJsx: vueJsx(),
  13. },
  14. // 覆盖插件选项
  15. }),
  16. ],
  17. server: {
  18. host: true,
  19. port: 3000,
  20. },
  21. build: {
  22. lib: {
  23. entry: resolve(__dirname, 'src/index.ts'),
  24. name: 'antdx',
  25. fileName: 'index',
  26. },
  27. rollupOptions: {
  28. external: [...externals],
  29. output: {
  30. globals: {
  31. 'vue': 'Vue',
  32. },
  33. },
  34. },
  35. outDir: 'dist',
  36. },
  37. resolve: {
  38. dedupe: ['vue'],
  39. },
  40. optimizeDeps: {
  41. include: [...externals],
  42. },
  43. });