vite.config.ts 965 B

12345678910111213141516171819202122232425262728293031323334353637383940
  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. },
  21. // 配置 @ 别名
  22. resolve: {
  23. alias: {
  24. '@': '/src',
  25. },
  26. },
  27. // 构建配置
  28. build: {
  29. // 对于SSR,我们不需要默认的index.html入口
  30. // 为客户端构建指定JS入口文件
  31. rollupOptions: {
  32. input: {
  33. // 这里指定你的客户端入口JS文件
  34. main: 'src/client/index.tsx',
  35. styles: 'src/style.css',
  36. },
  37. },
  38. },
  39. })