Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

微信基础库兼容性 #16887

Open
littlexiang opened this issue Nov 18, 2024 · 0 comments
Open

微信基础库兼容性 #16887

littlexiang opened this issue Nov 18, 2024 · 0 comments
Labels
F-react Framework - React T-weapp Target - 编译到微信小程序 V-3 Version - 3.x

Comments

@littlexiang
Copy link

littlexiang commented Nov 18, 2024

相关平台

微信小程序

小程序基础库: 3.6.4
使用框架: React

复现步骤

taro build --type weapp

async function login() {
  return Taro.login()
    .then((res) => {
      if (res.code) {
        return new Promise((resolve, reject) => {
          wx.request({
            url:
              config.getEnvConfig()["apiBaseUrl"][config.appName.group_on_v2] +
              "auth/code2session",
            method: "POST",
            data: {
              code: res.code,
              options: Taro.getLaunchOptionsSync()
            },
            success: ({ data, statusCode }) => {
              //处理逻辑
            },
            fail: (e) => {
              reject(e?.errMSg)
            }
          })
        }).catch(errHandler)
      }
    })
    .catch(errHandler)
}

此时request线程会卡死, 在真机调试console中, 这个请求一直处于pending, 实际抓包查看, 接口已经正常返回

期望结果

运行正常

实际结果

卡死

环境信息

👽 Taro v3.6.35

  Taro CLI 3.6.35 environment info:
    System:
      OS: macOS 14.6.1
      Shell: 5.9 - /bin/zsh
    Binaries:
      Node: 20.18.0 - ~/.nvm/versions/node/v20.18.0/bin/node
      Yarn: 1.22.21 - /usr/local/bin/yarn
      npm: 10.8.2 - ~/.nvm/versions/node/v20.18.0/bin/npm
    npmPackages:
      @tarojs/cli: 3.6.35 => 3.6.35 
      @tarojs/components: 3.6.35 => 3.6.35 
      @tarojs/helper: 3.6.35 => 3.6.35 
      @tarojs/plugin-framework-react: 3.6.35 => 3.6.35 
      @tarojs/plugin-html: 3.6.35 => 3.6.35 
      @tarojs/plugin-platform-weapp: 3.6.35 => 3.6.35 
      @tarojs/plugin-react-devtools: 3.6.35 => 3.6.35 
      @tarojs/react: 3.6.35 => 3.6.35 
      @tarojs/router: 3.6.35 => 3.6.35 
      @tarojs/runtime: 3.6.35 => 3.6.35 
      @tarojs/shared: 3.6.35 => 3.6.35 
      @tarojs/taro: 3.6.35 => 3.6.35 
      @tarojs/webpack5-runner: 3.6.35 => 3.6.35 
      babel-preset-taro: 3.6.35 => 3.6.35 
      eslint-config-taro: 3.6.35 => 3.6.35 
      react: ^18.0.0 => 18.2.0 

补充信息

在微信基础库<=3.4.6时没有问题

3.4.6以上版本都会出现线程卡死, 具体现象为

  • 真机调试request请求pending无法获取结果, 其实接口已经正常返回
  • 界面渲染不出来, 只有tabbar
  • 手机端开发者console无法打开, 没有图标
  • 手机发烫
  • 微信崩溃重启, 会进入修复流程

如果使用--watch模式, 不让taro进行代码压缩, 使用开发者工具去压缩, 就不会出现问题
如果使用build打包则100%必现
在不同node(20/18/16)和taro(3.6.4/3.6.35)版本下, 结果都一样
疑似是webpack/babel对promise转换导致了不兼容

@TheKonka TheKonka added V-3 Version - 3.x F-react Framework - React T-weapp Target - 编译到微信小程序 labels Nov 22, 2024
This was referenced Nov 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
F-react Framework - React T-weapp Target - 编译到微信小程序 V-3 Version - 3.x
Projects
Status: Todo
Development

No branches or pull requests

2 participants