开发者工具上传代码出现偶现的异常导致报错,babel/runtime/helpers?
发布于 5 年前 作者 chengqiang 2024 次浏览 来自 官方Issues

小程序代码分包中使用以下写法

    // ES6 异常写法报错
    let value = {
      a: 1,
      b: 2
    }
    const { a, ...data } = value
    console.log(a, data)

然后上传体验版。在体验版访问到分包时出现以下报错信息。此问题偶尔出现,开发者工具正常。上传后发版导致线上进入分包页面空白

Error: module "[@babel](/user/babel)/runtime/helpers/objectWithoutProperties" is not defined
Error: module "[@babel](/user/babel)/runtime/helpers/objectWithoutProperties" is not defined

巨坑!目前解决办法是在app.js用这种格式写一个语法,暴露问题,防止此类问题。

社区上有很多babel/runtime/helpers报错的问题,不知是否都是这种情况

回到顶部