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.5.1 未对独立分包抽取公共模块 #12206

Closed
alexlees opened this issue Aug 3, 2022 · 0 comments · Fixed by #12209 or #12895
Closed

Taro 3.5.1 未对独立分包抽取公共模块 #12206

alexlees opened this issue Aug 3, 2022 · 0 comments · Fixed by #12209 or #12895
Labels
F-react Framework - React T-tt Target - 编译到字节跳动小程序 V-3 Version - 3.x

Comments

@alexlees
Copy link
Contributor

alexlees commented Aug 3, 2022

相关平台

字节跳动小程序

复现仓库

https://github.com/alexlees/taro_independent_bug/issues/new
小程序基础库: 无
使用框架: React

复现步骤

  1. Taro 3.5.1
  2. 使用 3.5.1 初始化新项目
  3. 新建独立分包
subPackages: [
    {
      name: 'independent',
      root: 'pages/independent',
      independent: true,
      pages: [
        'page1/index',
        // @todo 打开翻倍
        'page2/index',
      ]
    }
  ],
  1. 找一个很大的公共业务包(demo中以lodash代替)
  2. 两个页面中引入公共业务包
  3. build 后用 webpack-bundle-analyzer 查看打包情况

独立分包仅一个页面时:
截屏2022-08-03 15 18 52
独立分包两个页面时:
截屏2022-08-03 15 20 06

期望结果

拆分公共逻辑包 lodash

实际结果

未拆分公共逻辑,导致独立分包内新增页面最终包体积翻倍

环境信息

$ taro info
👽 Taro v3.5.1


  Taro CLI 3.5.1 environment info:
    System:
      OS: Linux 5.4 Debian GNU/Linux 10 (buster) 10 (buster)
      Shell: 5.9 - /home/linuxbrew/.linuxbrew/bin/zsh
    Binaries:
      Node: 16.15.1 - /tmp/yarn--1659511654982-0.4567325012450869/node
      Yarn: 1.22.15 - /tmp/yarn--1659511654982-0.4567325012450869/yarn
      npm: 8.11.0 - ~/.nvm/versions/node/v16.15.1/bin/npm
    npmPackages:
      @tarojs/cli: 3.5.1 => 3.5.1 
      @tarojs/components: 3.5.1 => 3.5.1 
      @tarojs/helper: 3.5.1 => 3.5.1 
      @tarojs/plugin-framework-react: 3.5.1 => 3.5.1 
      @tarojs/plugin-platform-alipay: 3.5.1 => 3.5.1 
      @tarojs/plugin-platform-jd: 3.5.1 => 3.5.1 
      @tarojs/plugin-platform-qq: 3.5.1 => 3.5.1 
      @tarojs/plugin-platform-swan: 3.5.1 => 3.5.1 
      @tarojs/plugin-platform-tt: 3.5.1 => 3.5.1 
      @tarojs/plugin-platform-weapp: 3.5.1 => 3.5.1 
      @tarojs/react: 3.5.1 => 3.5.1 
      @tarojs/router: 3.5.1 => 3.5.1 
      @tarojs/runtime: 3.5.1 => 3.5.1 
      @tarojs/shared: 3.5.1 => 3.5.1 
      @tarojs/taro: 3.5.1 => 3.5.1 
      @tarojs/taro-h5: 3.5.1 => 3.5.1 
      babel-preset-taro: 3.5.1 => 3.5.1 
      eslint-config-taro: 3.5.1 => 3.5.1 
      react: ^18.0.0 => 18.2.0 

Done in 0.64s.

补充信息

涉及:
@tarojs/mini-runner
@tarojs/webpack5-runner

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
F-react Framework - React T-tt Target - 编译到字节跳动小程序 V-3 Version - 3.x
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant