| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- import { defineConfig } from 'vite'
- import react from '@vitejs/plugin-react-swc'
- import tailwindcss from '@tailwindcss/vite'
- import { progressTrackingPlugin } from 'vite-progress-tracking-plugin';
- import iframeCommunicationPlugin from 'vite-plugin-iframe-communicator';
- // https://vite.dev/config/
- export default defineConfig({
- plugins: [
- react({
- tsDecorators: true,
- }),
- tailwindcss(),
- progressTrackingPlugin(),
- iframeCommunicationPlugin({
- hostOrigin: '*', // 可信的主页面源
- })
- ],
- server: {
- allowedHosts:true,
- proxy: {
- '/mini': {
- target: 'http://localhost:10086',
- changeOrigin: true,
- },
- '/mini-ws': {
- target: 'ws://localhost:10086/ws',
- changeOrigin: true,
- rewrite: path => path.replace(/^\/mini-ws/, ''),
- ws: true
- },
- },
- watch: {
- // 忽略指定目录,使用 glob 模式
- ignored: [
- '**/node_modules/**', // Vite 默认已忽略 node_modules
- '**/dist/**', // 忽略 dist 目录
- 'coverage/**',
- 'playwright-report/**',
- 'test-results/**',
- 'tests/**',
- ]
- }
- },
- // 配置 @ 别名
- resolve: {
- alias: {
- '@': '/src',
- },
- },
- // 构建配置
- build: {
- // 对于SSR,我们不需要默认的index.html入口
- // 为客户端构建指定JS入口文件
- rollupOptions: {
- input: {
- // 这里指定你的客户端入口JS文件
- main: 'src/client/index.tsx',
- styles: 'src/style.css',
- },
- },
- },
- })
|