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

prebundle在打包A依赖B,且项目中同时使用了AB两个包时重复打包内容 #15728

Open
JOU-amjs opened this issue May 14, 2024 · 0 comments

Comments

@JOU-amjs
Copy link

相关平台

微信小程序

重现链接

https://github.com/JOU-amjs/taro-prebundle-repeat-bundle

小程序基础库: 3.4.3
使用框架: React

复现步骤

  1. 安装依赖,并npm run dev:weapp启动项目
  2. 打开微信开发工具运行项目,可以看到报错
  3. 其中alova.ts中引入的alova包代码,和在app.ts中引入的@alova/scene-react(此包依赖了alova包),分别打包了两份alova代码,其中@alova/scene-react在prebundle中。
  4. config/dev.ts中关闭prebundle,或直接npm run build:weapp,则运行正常。

期望结果

prebundle模式下也可以共享同一份alova包的代码

实际结果

alova包的代码被打包了两份

环境信息

Taro CLI 3.6.28 environment info:
    System:
      OS: Windows 10 10.0.19043
    Binaries:
      Node: 18.19.0 - C:\Program Files\nodejs\node.EXE
      npm: 10.2.3 - C:\Program Files\nodejs\npm.CMD
    npmPackages:
      @tarojs/cli: 3.6.28 => 3.6.28
      @tarojs/components: 3.6.28 => 3.6.28
      @tarojs/helper: 3.6.28 => 3.6.28
      @tarojs/plugin-framework-react: 3.6.28 => 3.6.28
      @tarojs/plugin-platform-alipay: 3.6.28 => 3.6.28
      @tarojs/plugin-platform-h5: 3.6.28 => 3.6.28
      @tarojs/plugin-platform-jd: 3.6.28 => 3.6.28
      @tarojs/plugin-platform-qq: 3.6.28 => 3.6.28
      @tarojs/plugin-platform-swan: 3.6.28 => 3.6.28
      @tarojs/plugin-platform-tt: 3.6.28 => 3.6.28
      @tarojs/plugin-platform-weapp: 3.6.28 => 3.6.28
      @tarojs/react: 3.6.28 => 3.6.28
      @tarojs/runtime: 3.6.28 => 3.6.28
      @tarojs/shared: 3.6.28 => 3.6.28
      @tarojs/taro: 3.6.28 => 3.6.28
      @tarojs/taro-loader: 3.6.28 => 3.6.28
      @tarojs/webpack5-runner: 3.6.28 => 3.6.28
      babel-preset-taro: 3.6.28 => 3.6.28
      eslint-config-taro: 3.6.28 => 3.6.28
      react: ^18.0.0 => 18.3.1

补充信息

我的研究:prebundle把同一个包当做了两个包了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant