Skip to content

npm发布包的版本问题 #348

Closed
Closed

Description

@luo2430

Describe the bug

@galacean/engine-toolkit-controls 的当前版本有些问题,将0.0.0-experimental-backup.6识别为最新版本而不是1.6.0版本,而且包内有较大体积js文件,正常版本(1.6或2.0)的js文件体积只有600 KB左右。@galacean/engine-toolkit-xr-tool 的当前版本(.3)没问题,但(.14)版本也出现了较大体积js文件,可能是一个问题。

Expected behavior

默认下载的是正常版本

Screenshots

默认添加

Image

包内有较大体积的文件,正常版本(1.6或2.0)的js文件体积只有600 KB左右

Image

npm和npmx

Image Image

Activity

  1. cptbtptpbcptdtptp commented on Jun 16, 2026

    @cptbtptpbcptdtptp
    Collaborator

    感谢反馈,已修复 👍

    @galacean/engine-toolkit-controls 的 latest dist-tag 已重新指向 1.6.0(已在 registry 核对)。现在 npm i @galacean/engine-toolkit-controls 默认安装的就是正常的 1.6.0(解包 ~390KB),不再是之前误发到 latest 的 0.0.0-experimental-backup.6(~2.8MB)。

    原因:那个 experimental backup 发布时没带 --tag,被默认写进了 latest 把稳定版覆盖了(npm 的 latest 是"最后一次不带 tag 发布的版本",并不会自动选最高语义版本)。

    关于 @galacean/engine-toolkit-xr-tool:它的 latest 指向 0.0.0-experimental-1.3-xr.4(即你说没问题的那个),而体积偏大的 .14 挂在 experimental tag 下,只有显式 @experimental 才会装到,不影响默认安装——这属于另一回事(xr-tool 目前还没有正式稳定版),会单独跟进。

  2. cptbtptpbcptdtptp commented on Jun 16, 2026

    @cptbtptpbcptdtptp
    Collaborator

    补充跟进一下 @galacean/engine-toolkit-xr-tool 体积偏大的问题——根因已经定位并修复:

    小程序构建(miniprogram build)的 Rollup 配置有两个缺陷,导致 @galacean/engine-xr 及其依赖 @galacean/engine-math 被内联打包而非外部化,dist/miniprogram.js 从正常的 ~80KB 膨胀到 ~2.5MB:

    1. rollup.config.mjs 的 external 列表只声明了 ${name}/dist/miniprogram 路径,裸包名不在其中——没有被重定向的 peer 依赖会被静默打包。
    2. rollup.miniprogram.plugin.mjs 的重定向正则对 @galacean/engine-xr 用了单引号匹配,但转译后源码是双引号,导致该 import 永远匹配不上。

    修复 PR:#350,已验证修复后 @galacean/engine-xr 正确外部化、不再被打包。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions