NervJS / taro-ui

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

watch 模式下,无法正常显示AtInput title #1711

Closed linlijason closed 10 months ago

linlijason commented 10 months ago

运行环境: Taro CLI 3.6.19 environment info: System: OS: macOS 12.4 Shell: 5.8.1 - /bin/zsh Binaries: Node: 18.17.0 - /usr/local/bin/node Yarn: 1.22.11 - /usr/local/bin/yarn npm: 9.6.7 - /usr/local/bin/npm npmPackages: @tarojs/cli: 3.6.19 => 3.6.19 @tarojs/components: 3.6.19 => 3.6.19 @tarojs/helper: 3.6.19 => 3.6.19 @tarojs/plugin-framework-react: 3.6.19 => 3.6.19 @tarojs/plugin-platform-alipay: 3.6.19 => 3.6.19 @tarojs/plugin-platform-h5: 3.6.19 => 3.6.19 @tarojs/plugin-platform-jd: 3.6.19 => 3.6.19 @tarojs/plugin-platform-qq: 3.6.19 => 3.6.19 @tarojs/plugin-platform-swan: 3.6.19 => 3.6.19 @tarojs/plugin-platform-tt: 3.6.19 => 3.6.19 @tarojs/plugin-platform-weapp: 3.6.19 => 3.6.19 @tarojs/react: 3.6.19 => 3.6.19 @tarojs/runtime: 3.6.19 => 3.6.19 @tarojs/shared: 3.6.19 => 3.6.19 @tarojs/taro: 3.6.19 => 3.6.19 @tarojs/taro-loader: 3.6.19 => 3.6.19 @tarojs/webpack5-runner: 3.6.19 => 3.6.19 babel-preset-taro: 3.6.19 => 3.6.19 eslint-config-taro: 3.6.19 => 3.6.19 react: ^18.0.0 => 18.2.0 taro-ui: ^3.2.0 => 3.2.0

问题描述: 在watch时,如果不显示的引入Label组件,无法正确显示AtInput的title. 复现的方式:

  1. 页面的内容: image

yarn dev:weapp 运行之后,如图所示:title显示不出来

image
  1. 当 我在另一个页面中(一个无用的页面)导入 Label并使用. `import { View,Input,Button,Label } from "@tarojs/components"

    return (

    测试

另外,此问题只在watch模式下出现。 不使用watch打包的结果能正常显示

taro-ui-bot[bot] commented 10 months ago

欢迎提交 Issue~

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

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

Good luck and happy coding~

robinv8 commented 10 months ago

排查 config/index.js 中是否有如下配置,如果使用了 webpack 5,则需要如下修改成如下配置:

 compiler: {
      type: 'webpack5',
      prebundle: {
        exclude: ['taro-ui']
      }
    }
linlijason commented 10 months ago

解决了,谢谢