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 3.3.10 编译 H5 没有 tree shaking #10466

Closed
zousandian opened this issue Oct 20, 2021 · 5 comments · Fixed by #10891
Closed

Taro 3.3.10 编译 H5 没有 tree shaking #10466

zousandian opened this issue Oct 20, 2021 · 5 comments · Fixed by #10891
Labels
F-react Framework - React T-h5 Target - 编译到 H5 V-3 Version - 3.x

Comments

@zousandian
Copy link

相关平台

H5

复现仓库

https://github.com/zousandian/taro3test
浏览器版本: chrome 62
使用框架: React

复现步骤

使用 taro init 默认模版,没有引入 taro-ui,编译H5体积都高达900多K

taro init test
cd test
npm install && npm run build:h5

image

期望结果

按照 taro 文章的说法,应该是优化过 tree shaking 的
https://taro-docs.jd.com/taro/blog/2019-02-28-taro-h5-optimize

实际结果

H5 编译 tree shaking 没有生效

环境信息

👽 Taro v3.3.10


  Taro CLI 3.3.10 environment info:
    System:
      OS: macOS 11.5
      Shell: 5.8 - /bin/zsh
    Binaries:
      Node: 14.18.0 - /usr/local/bin/node
      Yarn: 1.22.4 - /usr/local/bin/yarn
      npm: 6.14.15 - /usr/local/bin/npm
    npmPackages:
      @tarojs/components: 3.3.10 => 3.3.10
      @tarojs/mini-runner: 3.3.10 => 3.3.10
      @tarojs/react: 3.3.10 => 3.3.10
      @tarojs/runtime: 3.3.10 => 3.3.10
      @tarojs/taro: 3.3.10 => 3.3.10
      @tarojs/webpack-runner: 3.3.10 => 3.3.10
      babel-preset-taro: 3.3.10 => 3.3.10
      eslint-config-taro: 3.3.10 => 3.3.10
      react: ^17.0.0 => 17.0.2
    npmGlobalPackages:
      typescript: 4.0.2
@taro-bot2 taro-bot2 bot added F-react Framework - React T-h5 Target - 编译到 H5 V-3 Version - 3.x labels Oct 20, 2021
@LuoQaxa
Copy link

LuoQaxa commented Nov 22, 2021

这个问题有进展了吗?也发现了同样的问题

@LuoQaxa
Copy link

LuoQaxa commented Nov 24, 2021

@tarojs/components 就算没有引入也被打包到项目中,在taro-loader 处理app.tsx时,直接引入了
image

@bobsam
Copy link

bobsam commented Nov 30, 2021

确实是在这个版本开始,tree shaking开始丢了。。

@bobsam
Copy link

bobsam commented Dec 9, 2021

@ZakaryCode 打小程序的tree-shaking是不是也没有了,我发现包体都大了一些。。。

@ZakaryCode
Copy link
Contributor

@ZakaryCode 打小程序的tree-shaking是不是也没有了,我发现包体都大了一些。。。

不至于,如果验证有问题可以单独再提个 issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
F-react Framework - React T-h5 Target - 编译到 H5 V-3 Version - 3.x
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

4 participants