NervJS / taro-ui

一款基于 Taro 框架开发的多端 UI 组件库
https://taro-ui.taro.zone
MIT License
4.52k stars 756 forks source link

taro-ui AtButton 编译成微信小程序只有 text 没有 button #1525

Closed NgChiKin closed 1 year ago

NgChiKin commented 2 years ago

Taro UI 版本信息

v3.1.0-beta.3

问题描述

如题 image

复现步骤

  1. 导入AtButton 在页面上使用
  2. 编译成小程序,就能出现了

复现代码

  <AtButton disabled={false} type="primary" openType="getPhoneNumber" onGetPhoneNumber={(e) => console.log(e)}>
    微信账号快捷登录
  </AtButton>

报错信息

系统信息

Taro CLI 3.5.4 environment info: System: OS: macOS 11.4 Shell: 5.8 - /bin/zsh Binaries: Node: 16.13.0 - ~/.nvm/versions/node/v16.13.0/bin/node Yarn: 1.22.17 - ~/.nvm/versions/node/v16.13.0/bin/yarn npm: 8.1.0 - ~/.nvm/versions/node/v16.13.0/bin/npm npmPackages: @tarojs/cli: 3.5.4 => 3.5.4 @tarojs/components: 3.5.4 => 3.5.4 @tarojs/helper: 3.5.4 => 3.5.4 @tarojs/plugin-framework-react: 3.5.4 => 3.5.4 @tarojs/plugin-platform-alipay: 3.5.4 => 3.5.4 @tarojs/plugin-platform-jd: 3.5.4 => 3.5.4 @tarojs/plugin-platform-qq: 3.5.4 => 3.5.4 @tarojs/plugin-platform-swan: 3.5.4 => 3.5.4 @tarojs/plugin-platform-tt: 3.5.4 => 3.5.4 @tarojs/plugin-platform-weapp: 3.5.4 => 3.5.4 @tarojs/react: 3.5.4 => 3.5.4 @tarojs/router: 3.5.4 => 3.5.4 @tarojs/runtime: 3.5.4 => 3.5.4 @tarojs/shared: 3.5.4 => 3.5.4 @tarojs/taro: 3.5.4 => 3.5.4 @tarojs/taro-h5: 3.5.4 => 3.5.4 @tarojs/webpack5-runner: 3.5.4 => 3.5.4 babel-preset-taro: 3.5.4 => 3.5.4 eslint-config-taro: 3.5.4 => 3.5.4 react: ^18.0.0 => 18.2.0 taro-ui: ^2.3.4 => 2.3.4

补充信息

taro-ui-bot[bot] commented 2 years ago

欢迎提交 Issue~

如果你提交的是 bug 报告,请务必遵循 Issue 模板的规范,尽量用简洁的语言描述你的问题,最好能提供一个稳定简单的复现。🙏🙏🙏

如果你的信息提供过于模糊或不足,或者已经其他 issue 已经存在相关内容,你的 issue 有可能会被关闭。

Good luck and happy coding~

NgChiKin commented 2 years ago

测试了一下,脚手架Taro 版本还是使用 3.5.4 版本,但是选用webpack 4作为构建工具,就没有问题,使用 webpack5版本就有问题

NgChiKin commented 2 years ago

使用3.5.3版本init项目webpack5版本 + taro-ui 模版,运行报错,以下截图

image

使用 3.52 版本 init项目 webapck5版本+ taro-ui 模版,就能正常渲染出 button。

shinken008 commented 1 year ago

https://taro-docs.jd.com/taro/docs/config-detail#compilerprebundleexclude

taro-ui 不要进行预编译

compiler: {
    prebundle: {
      exclude: ['taro-ui']
    }
  }
NgChiKin commented 1 year ago

@shinken008 这个看了一会就知道了,真正的错误是什么?没有解决根本的问题?如果我就是要开启预编译,怎么解决