dev.ts 984 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. import type { UserConfigExport } from "@tarojs/cli"
  2. export default {
  3. logger: {
  4. quiet: false,
  5. stats: true
  6. },
  7. compiler: {
  8. // 关闭开发模式的依赖预编译,减少主包体积以支持微信小程序开发版预览(2MB限制)
  9. prebundle: {
  10. enable: false
  11. }
  12. },
  13. mini: {},
  14. h5: {
  15. devServer: {
  16. port: 10087,
  17. // 配置 HMR WebSocket 端口
  18. client: {
  19. progress: true,
  20. webSocketURL: {
  21. pathname: '/talent-mini-ws',
  22. port: 443, // 指定 HMR WebSocket 端口
  23. },
  24. },
  25. open: false
  26. },
  27. webpackChain(chain) {
  28. // 确保在 HtmlWebpackPlugin 之后添加
  29. chain
  30. .plugin('iframeCommunicationPlugin')
  31. .use(require('webpack-plugin-iframe-communicator').default, [{
  32. hostOrigin: '*',
  33. }])
  34. .after('htmlWebpackPlugin'); // 指定在 htmlWebpackPlugin 之后执行
  35. }
  36. }
  37. } satisfies UserConfigExport<'webpack5'>