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

升级到最新的3.6.17版本后,部分页面出现大量报错 #14610

Closed
MuYiBo opened this issue Sep 27, 2023 · 1 comment · Fixed by #14665, #14688 or #14690
Closed

升级到最新的3.6.17版本后,部分页面出现大量报错 #14610

MuYiBo opened this issue Sep 27, 2023 · 1 comment · Fixed by #14665, #14688 or #14690
Labels
F-react Framework - React T-weapp Target - 编译到微信小程序 V-3 Version - 3.x

Comments

@MuYiBo
Copy link

MuYiBo commented Sep 27, 2023

相关平台

微信小程序

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

复现步骤

taro系列框架升级到最新的3.6.17版本后,在我的小程序的某个页面中,出现了大量的这个报错。在之前3.6.15版本时没有这个报错。

TypeError: Cannot read property 'split' of undefined
    at :50140/appservice/a
    at :50140/appservice/base.wxml:1003(env: macOS,mp,1.06.2303220; lib: 3.1.0)

经过查看报错内容发现,报错的问题点在 编译后根目录的 utils.wxs 文件中的 a 方法中。

a: function (l, n, s) {
    var a = ["7","0","21","5","2","12","6","4","55","56","29","23","52","60","61","send-coupon","popup-component","t-captcha","custom-wrapper"]
    var b = ["4","55","56","29","23","52","60","61"]
    if (a.indexOf(n) === -1) {
      l = 0
    }
    if (b.indexOf(n) > -1) {
      var u = s.split(',')
      var depth = 0
      for (var i = 0; i < u.length; i  ) {
        if (u[i] === n) depth  
      }
      l = depth
    }
    if (l === 15) {
      return 'tmpl_15_container'
    }
    return 'tmpl_'   l   '_'   n
  },

上面的代码中,s.split(',') 引发的报错。而这个a方法是在编译后根目录的 base.wxml 文件中调用的。
例如其中一段报错的位置:

<template name="tmpl_4_2">
  <view style="{{i.st}}" class="{{i.cl}}"  id="{{i.uid||i.sid}}" data-sid="{{i.sid}}">
    <block wx:for="{{i.cn}}" wx:key="sid">
      <template is="{{xs.a(c, item.nn, l)}}" data="{{i:item,c:c 1,l:xs.f(l,item.nn)}}" />
    </block>
  </view>
</template>

猜测是使用模板时,其中某个环节,l 参数为 undefined,导致的报错。但是不确定什么情况下会出现

期望结果

不报错异常

实际结果

部分页面报错异常

环境信息

Taro CLI 3.6.15 environment info:
    System:
      OS: macOS 13.4
      Shell: 5.9 - /bin/zsh
    Binaries:
      Node: 14.21.2 - ~/.nvm/versions/node/v14.21.2/bin/node
      Yarn: 1.22.10 - /usr/local/bin/yarn
      npm: 6.14.17 - ~/.nvm/versions/node/v14.21.2/bin/npm
    npmPackages:
      @tarojs/cli: 3.6.17 => 3.6.17 
      @tarojs/components: 3.6.17 => 3.6.17 
      @tarojs/mini-runner: 3.6.17 => 3.6.17 
      @tarojs/plugin-framework-react: 3.6.17 => 3.6.17 
      @tarojs/plugin-platform-h5: 3.6.17 => 3.6.17 
      @tarojs/plugin-react-devtools: 3.6.17 => 3.6.17 
      @tarojs/react: 3.6.17 => 3.6.17 
      @tarojs/runtime: 3.6.17 => 3.6.17 
      @tarojs/taro: 3.6.17 => 3.6.17 
      @tarojs/webpack-runner: 3.6.17 => 3.6.17 
      babel-preset-taro: 3.6.17 => 3.6.17 
      eslint-config-taro: 3.6.17 => 3.6.17 
      react: ^17.0.0 => 17.0.2 
      taro-ui: 3.1.0-beta.3 => 3.1.0-beta.3 
    npmGlobalPackages:
      typescript: 5.0.2
@taro-bot2 taro-bot2 bot added F-react Framework - React T-weapp Target - 编译到微信小程序 V-3 Version - 3.x labels Sep 27, 2023
@MuYiBo
Copy link
Author

MuYiBo commented Sep 27, 2023

找到报错的原因了,升级到3.6.17后,使用了 CustomWrapper 组件的,都出现这个报错了。然后影响页面的正常渲染

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
Archived in project
1 participant