import type { UserConfigExport } from "@tarojs/cli"

export default {
  logger: {
    quiet: false,
    stats: true
  },
  mini: {},
  h5: {
    devServer: {
      // 配置 HMR WebSocket 端口
      client: {
        progress: true,
        webSocketURL: {
          pathname: '/mini-ws',
          port: 443, // 指定 HMR WebSocket 端口
        },
      },
      open: false
    },
    webpackChain(chain, webpack) {  
      // 确保在 HtmlWebpackPlugin 之后添加  
      chain  
        .plugin('iframeCommunicationPlugin')  
        .use(require('webpack-plugin-iframe-communicator').default, [{  
          hostOrigin: '*',
        }])  
        .after('htmlWebpackPlugin'); // 指定在 htmlWebpackPlugin 之后执行  
    }
  }
} satisfies UserConfigExport<'webpack5'>
