sonofmagic / weapp-tailwindcss

bring tailwindcss to weapp ! 把 `tailwindcss` 原子化思想带入小程序开发吧 ! 原 `weapp-tailwindcss-webpack-plugin`
https://weapp-tw.icebreaker.top
MIT License
1.12k stars 82 forks source link

新创建的Taro项目按指南配置后,出现wxml文件编译错误 #268

Closed Runc2333 closed 6 months ago

Runc2333 commented 6 months ago

描述这个Bug A clear and concise description of what the bug is.

新创建的taro项目,按照指南配置完成后无法正确生成wxml。 猜测是依赖版本问题。 具体报错如下:

[ WXML 文件编译错误] ./base.wxml
unexpected character `{`
   7 | 
   8 | <template name="tmpl_0_0">
>  9 |   <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" 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" catchtouchmove="eh"  id="{{i.uid||i.sid}}" data-sid="{{i.sid}}">
     |                                                                   ^
  10 |     <block wx:for="{{i.cn}}" wx:key="sid">
  11 |       <template is="{{xs.a(c, item.nn, l)}}" data="{{i:item,c:c+1,l:xs.f(l,item.nn)}}" />
  12 |     </block>
at files://base.wxml#9

代码url

生成的部分错误wxml如下:

<template name="tmpl_0_0">
  <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" 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" catchtouchmove="eh"  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>

可以看到hover-class="{{xs.b(i.p1,'none')}}class="{{i.cl}}缺少了"

如何重现 Steps to reproduce the behavior:

  1. 删除taro模板项目下的yarn.lock文件,重新安装依赖,即可复现。

屏幕截图(可选) If applicable, add screenshots to help explain your problem.

image

运行环境

Additional context Add any other context about the problem here.

因能力有限,未能找到是哪个包的版本更新导致了这个错误。 如果有朋友同样遇到了这个问题,可以先通过使用模板项目中的yarn.lock文件替换您自己的项目中的yarn.lock并重新安装依赖来临时解决这个问题。

sonofmagic commented 6 months ago

经过测试,是 htmlparser2 这2天发布了 9.1.0 版本,这个版本有 bug 导致的这个问题。

现在已经将它的版本锁定在了 9.0.0 修复了这个问题,发布了插件的 3.0.5 版本。