2
0

vite.config.ts 1023 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. import { defineConfig } from 'vite'
  2. import react from '@vitejs/plugin-react-swc'
  3. import tailwindcss from '@tailwindcss/vite'
  4. import { progressTrackingPlugin } from 'vite-progress-tracking-plugin';
  5. import iframeCommunicationPlugin from 'vite-plugin-iframe-communicator';
  6. // https://vite.dev/config/
  7. export default defineConfig({
  8. plugins: [
  9. react({
  10. tsDecorators: true,
  11. }),
  12. tailwindcss(),
  13. progressTrackingPlugin(),
  14. iframeCommunicationPlugin({
  15. hostOrigin: '*', // 可信的主页面源
  16. })
  17. ],
  18. server: {
  19. allowedHosts:true,
  20. watch:{
  21. ignored:[
  22. 'docs'
  23. ]
  24. }
  25. },
  26. // 配置 @ 别名
  27. resolve: {
  28. alias: {
  29. '@': '/src',
  30. },
  31. },
  32. // 构建配置
  33. build: {
  34. // 对于SSR,我们不需要默认的index.html入口
  35. // 为客户端构建指定JS入口文件
  36. rollupOptions: {
  37. input: {
  38. // 这里指定你的客户端入口JS文件
  39. main: 'src/client/index.tsx',
  40. styles: 'src/style.css',
  41. },
  42. },
  43. },
  44. })