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

taro-h5 中 useReady 等方法导出问题 #8189

Closed
xughv opened this issue Dec 3, 2020 · 2 comments · Fixed by #8192
Closed

taro-h5 中 useReady 等方法导出问题 #8189

xughv opened this issue Dec 3, 2020 · 2 comments · Fixed by #8192
Labels
F-react Framework - React T-weapp Target - 编译到微信小程序 V-3 Version - 3.x
Milestone

Comments

@xughv
Copy link
Contributor

xughv commented Dec 3, 2020

相关平台

H5

复现仓库

https://github.com/xughv/taro-test

使用框架: React

复现步骤

位于 node_modules 中的文件如果使用到 @tarojs/taro 中部分方法会报错:

import { useReady } from "@tarojs/taro";

image

期望结果

可正常使用。

修正 taro-h5/src/index 导出,当前 useReady 等方法仅包含在 export default 对象中。

image

实际结果

非默认导出中未包含 useReady 等方法。

环境信息

  Taro CLI 3.0.14 environment info:
    System:
      OS: Linux 4.4 Ubuntu 18.04.2 LTS (Bionic Beaver)      
      Shell: 5.4.2 - /usr/bin/zsh
    Binaries:
      Node: 12.13.0 - /usr/local/bin/node
      Yarn: 1.9.2 - /mnt/c/Program Files (x86)/Yarn/bin/yarn
      npm: 6.12.0 - /usr/local/bin/npm
    npmPackages:
      @tarojs/components: 3.0.17 => 3.0.17
      @tarojs/mini-runner: 3.0.17 => 3.0.17
      @tarojs/react: 3.0.17 => 3.0.17
      @tarojs/runtime: 3.0.17 => 3.0.17
      @tarojs/taro: 3.0.17 => 3.0.17
      @tarojs/webpack-runner: 3.0.17 => 3.0.17
      babel-preset-taro: 3.0.17 => 3.0.17
      eslint-config-taro: 3.0.17 => 3.0.17
      react: ^16.10.0 => 16.14.0

补充信息

项目目录中文件未出现该问题是因为 esm 通过 Babel 进行了转换,尝试修改 webpack-runner 中 babel-loader exclude 不覆盖 node_modules 也将不会产生报错。

@taro-bot2 taro-bot2 bot added F-react Framework - React T-weapp Target - 编译到微信小程序 V-3 Version - 3.x labels Dec 3, 2020
@xughv
Copy link
Contributor Author

xughv commented Dec 3, 2020

缺失了 @tarojs/runtime 中方法

@xughv
Copy link
Contributor Author

xughv commented Dec 3, 2020

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
None yet
Development

Successfully merging a pull request may close this issue.

2 participants