You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Babel 8.0.0 shipped on 2026-06-16, but Taro main (4.2.0) / babel-preset-taro still pin @babel/core ^7. Downstream pnpm monorepos hit un-reconcilable interop issues because the babel toolchain is effectively "all-7 or all-8" — e.g. @babel/helper-compilation-targets@7.x does new (require('lru-cache'))() and crashes when a hoisted lru-cache@11 ({ LRUCache }, non-constructable) is resolved; and force-overriding just that helper to 8.0.0 then crashes on import '@babel/compat-data/native-modules' with { type: 'json' } against a hoisted @babel/compat-data@7 (which exports that path as .js). I noticed you're already fixing Babel 8 compat issues piecemeal (e.g. #18368).
Questions: (1) Is there a plan/timeline to move Taro's babel toolchain to @babel/core ^8? (2) Any tracking issue / RFC / branch? (3) Are fixes like #18368 part of a path to full Babel 8 support, or just defensive compat? (4) How can external contributors help (testing, per-package migration, compat PRs)? Happy to test/contribute. Thanks!
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
背景
main(4.2.0)与babel-preset-taro仍固定在@babel/core: ^7.24.4及整套@babel/* ^7。Scope#references is not available in Babel 8. Use Scope#referencesSet instead),所以想确认一下整体方向。动机:下游 interop 痛点(概括示例)
在基于 pnpm 的 monorepo 里,当 Taro 的 babel 工具链锁在 babel-7、而项目其它依赖已进入 babel-8 生态(lru-cache v11 等)时,会出现无法局部调和的 interop 问题。一个有代表性的例子:
@babel/helper-compilation-targets@7.x内部new (require('lru-cache'))(),期望 lru-cache v5 那种「可调用的默认导出」;一旦解析到 hoist 上来的 lru-cache v11({ LRUCache }命名导出、不可new),就抛TypeError: _lruCache is not a constructor。import browserModulesData from '@babel/compat-data/native-modules' with { type: 'json' },而工具链里 hoist 的@babel/compat-data仍是 7.x(把该子路径导出为.js而非 JSON)→TypeError: Module .../native-modules.js is not of type "json"。也就是说,babel 工具链实际上是「要么全 7、要么全 8」,下游没法把单个 helper 混到 8。结果只能靠 patch / 锁版本临时规避,直到 Taro 整体迁移到 babel-8 才能干净解决。
想确认的问题
@babel/core、babel-preset-taro等)整体升级到^8的计划与大致时间线?很乐意协助测试或贡献 PR。谢谢!
English TL;DR
Babel 8.0.0 shipped on 2026-06-16, but Taro
main(4.2.0) /babel-preset-tarostill pin@babel/core ^7. Downstream pnpm monorepos hit un-reconcilable interop issues because the babel toolchain is effectively "all-7 or all-8" — e.g.@babel/helper-compilation-targets@7.xdoesnew (require('lru-cache'))()and crashes when a hoistedlru-cache@11({ LRUCache }, non-constructable) is resolved; and force-overriding just that helper to 8.0.0 then crashes onimport '@babel/compat-data/native-modules' with { type: 'json' }against a hoisted@babel/compat-data@7(which exports that path as.js). I noticed you're already fixing Babel 8 compat issues piecemeal (e.g. #18368).Questions: (1) Is there a plan/timeline to move Taro's babel toolchain to
@babel/core ^8? (2) Any tracking issue / RFC / branch? (3) Are fixes like #18368 part of a path to full Babel 8 support, or just defensive compat? (4) How can external contributors help (testing, per-package migration, compat PRs)? Happy to test/contribute. Thanks!All reactions