dev.ts 786 B

12345678910111213141516171819202122232425262728293031
  1. import type { UserConfigExport } from "@tarojs/cli"
  2. export default {
  3. logger: {
  4. quiet: false,
  5. stats: true
  6. },
  7. mini: {},
  8. h5: {
  9. devServer: {
  10. // 配置 HMR WebSocket 端口
  11. client: {
  12. progress: true,
  13. webSocketURL: {
  14. pathname: '/mini-ws',
  15. port: 443, // 指定 HMR WebSocket 端口
  16. },
  17. },
  18. open: false
  19. },
  20. webpackChain(chain, webpack) {
  21. // 确保在 HtmlWebpackPlugin 之后添加
  22. chain
  23. .plugin('iframeCommunicationPlugin')
  24. .use(require('webpack-plugin-iframe-communicator').default, [{
  25. hostOrigin: '*',
  26. }])
  27. .after('htmlWebpackPlugin'); // 指定在 htmlWebpackPlugin 之后执行
  28. }
  29. }
  30. } satisfies UserConfigExport<'webpack5'>