Skip to content

编译后的代码 taro.js 和 verdors.js 循环引用 #16424

@fisker

Description

@fisker

相关平台

微信小程序

小程序基础库: 3.5.2
使用框架: Vue 3

复现步骤

使用 vite vue3 时 编译的产物 taro.js 可能需要 babel 的代码 比如 @babel/helpers/lib/helpers/typeof.js, 现在的分包策略会导致其被打包进 vendors.js 从而导致循环引用

本地测试,

if (testByReg2DExpList([taroDeps, vueRelatedDeps, tslibDeps, commonjsHelpersDeps])(id)) return 'taro'

加上 /@babel\//.test(id) 打包到 taro.js 可以解决。

期望结果

正常工作

实际结果

An error thrown with a message like

taro.defineComponent is not a function

环境信息

Taro v4.0.4


  Taro CLI 4.0.4 environment info:
    System:
      OS: Windows 10 10.0.19044
    Binaries:
      Node: 20.15.0
      Yarn: 1.22.22
      npm: 10.7.0
    npmPackages:
     <ommited, I'm not current on that branch>

Metadata

Metadata

Assignees

No one assigned

    Labels

    F-vue3Framework - Vue 3T-weappTarget - 编译到微信小程序V-3Version - 3.x

    Type

    No type

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions