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
1.使用以下命令构建cross-env NODE_ENV=test taro build --type alipay
2.获取构建产物打开调试工具
3.控制台报错
TypeError: Constructor Map requires 'new'
at ze.Map ()
at new ze (taro.js:2)
at Object. (taro.js:2)
at Object._ (taro.js:2)
at l (runtime.js:1)
at Module._ (app.js:2)
at l (runtime.js:1)
at t (runtime.js:1)
at Array.r [as push] (runtime.js:1)
at Object.GfhN (app.js:2)
相关平台
支付宝小程序
小程序基础库: 2.7.15
使用框架: React
复现步骤
1.使用以下命令构建cross-env NODE_ENV=test taro build --type alipay
2.获取构建产物打开调试工具
3.控制台报错
TypeError: Constructor Map requires 'new'
at ze.Map ()
at new ze (taro.js:2)
at Object. (taro.js:2)
at Object._ (taro.js:2)
at l (runtime.js:1)
at Module._ (app.js:2)
at l (runtime.js:1)
at t (runtime.js:1)
at Array.r [as push] (runtime.js:1)
at Object.GfhN (app.js:2)
期望结果
能正常运行
实际结果
taro运行时代码报错,导致小程序页面注册失败,无法打开页面
环境信息
补充信息
初步排查,在Taro运行时代码里有一段event-source的逻辑,这里对Map进行了继承扩展并创建实例暴露出去。在测试环境打包构建压缩的时候,这里的实例化的动作括号丢失了,导致最终产物中这里没有进行实例化创建
// 源码
class EventSource extends Map {
removeNode (child: TaroNode) {
const { sid, uid } = child
this.delete(sid)
if (uid !== sid && uid) this.delete(uid)
}
removeNodeTree (child: TaroNode) {
this.removeNode(child)
const { childNodes } = child
childNodes.forEach(node => this.removeNodeTree(node))
}
}
export const eventSource: IEventSource = new EventSource()
// 构建产物
class ze extends Map {
removeNode(e) {
const {sid: t, uid: n} = e;
this.delete(t),
n !== t && n && this.delete(n)
}
removeNodeTree(e) {
this.removeNode(e);
const {childNodes: t} = e;
t.forEach(e=>this.removeNodeTree(e))
}
}
const He = new ze;
The text was updated successfully, but these errors were encountered: