NervJS / taro

开放式跨端跨框架解决方案,支持使用 React/Vue/Nerv 等框架来开发微信/京东/百度/支付宝/字节跳动/ QQ 小程序/H5/React Native 等应用。 https://taro.zone/
https://docs.taro.zone/
Other
35.34k stars 4.77k forks source link

Taro3.6.25 开启 Prebundle 微信小程序会报 Template `tmpl_0_13` not found 警告 #15493

Open qq31311137 opened 5 months ago

qq31311137 commented 5 months ago

相关平台

微信小程序

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

复现步骤

  1. npm install @taro/cli -g
  2. taro init project,使用 npm,使用 typescript,使用 gitree 模板,使用 taro-ui 模板
  3. npm install
  4. npm run dev:weapp
  5. 在页面引入 @taro/components 的 Button 组件
  6. 用微信开发工具预览项目

期望结果

在 taro 3.6.25 版本中使用 webpack5 的 Prebundle 像 build 一样没有问题, 使用 Button 组件不会出现警告

实际结果

[WXML Runtime warning] ./base.wxml
 Template `tmpl_0_13` not found.
  109 |   <view hover-class="{{xs.b(i.p1,'none')}}" hover-stop-propagation="{{xs.b(i.p4,!1)}}" hover-start-time="{{xs.b(i.p2,50)}}" hover-stay-time="{{xs.b(i.p3,400)}}" bindtouchstart="eh" bindtouchmove="eh" bindtouchend="eh" bindtouchcancel="eh" bindlongpress="eh" animation="{{i.p0}}" bindanimationstart="eh" bindanimationiteration="eh" bindanimationend="eh" bindtransitionend="eh" style="{{i.st}}" class="{{i.cl}}" bindtap="eh"  id="{{i.uid||i.sid}}" data-sid="{{i.sid}}">
  110 |     <block wx:for="{{i.cn}}" wx:key="sid">
> 111 |       <template is="{{xs.a(c, item.nn, l)}}" data="{{i:item,c:c 1,l:xs.f(l,item.nn)}}" />
      |                    ^
  112 |     </block>
  113 |   </view>
  114 | </template>

环境信息

👽 Taro v3.6.25

  Taro CLI 3.6.25 environment info:
    System:
      OS: Windows 10 10.0.19045
    Binaries:
      Node: 18.20.1 - D:\node\node.EXE
      npm: 10.5.0 - D:\node\npm.CMD
    npmPackages:
      @tarojs/cli: 3.6.25 => 3.6.25
      @tarojs/components: 3.6.25 => 3.6.25
      @tarojs/helper: 3.6.25 => 3.6.25
      @tarojs/plugin-framework-react: 3.6.25 => 3.6.25 
      @tarojs/plugin-platform-alipay: 3.6.25 => 3.6.25 
      @tarojs/plugin-platform-h5: 3.6.25 => 3.6.25     
      @tarojs/plugin-platform-jd: 3.6.25 => 3.6.25     
      @tarojs/plugin-platform-qq: 3.6.25 => 3.6.25     
      @tarojs/plugin-platform-swan: 3.6.25 => 3.6.25   
      @tarojs/plugin-platform-tt: 3.6.25 => 3.6.25     
      @tarojs/plugin-platform-weapp: 3.6.25 => 3.6.25  
      @tarojs/react: 3.6.25 => 3.6.25
      @tarojs/runtime: 3.6.25 => 3.6.25
      @tarojs/shared: 3.6.25 => 3.6.25
      @tarojs/taro: 3.6.25 => 3.6.25
      @tarojs/taro-loader: 3.6.25 => 3.6.25
      @tarojs/webpack5-runner: 3.6.25 => 3.6.25        
      babel-preset-taro: 3.6.25 => 3.6.25
      eslint-config-taro: 3.6.25 => 3.6.25
      react: ^18.0.0 => 18.2.0
      taro-ui: ^3.2.1 => 3.3.0

补充信息

经过测试这是使用了 @taro/components 的 Button 组件出现的警告,就算是使用 taro-ui 的 AtButton 也一样,大概是因为 AtButton 也是引用了 @taro/components 的 Button 组件

这个是只有开启了 webpack5 的 prebundle 才会出现的警告,使用 watch 会默认开启了 Prebundle ,个人又想使用 Prebundle 增加开发环境的编译模式,不想刚创建项目就得关掉 prebundle 这个特性

这个每次组件重新渲染都会报这个警告,所以有定时器的页面使用了 Button,会导致微信开发工具日志崩溃,希望官方排查一下 @taro/components 下的其他组件是否也会跟 Button 一样的问题

chenyong0923 commented 3 months ago

compiler: { type: 'webpack5', prebundle: { enable: false, include: ['@taro/components'], }, },

好像可行

jesse-li commented 2 months ago

vue也有这个问题,关闭prebundle就好了