首页 > 编程语言 >微信小程序开发工具,更新后报typeof4 is not a function

微信小程序开发工具,更新后报typeof4 is not a function

时间:2022-08-24 10:56:42浏览次数:90  
标签:function return 微信 typeof4 typeof2 typeof && Symbol

升级开发者工具版本后,新版工具将es6转es5和增强编译合并,报以下错误。

 

 

解决方法有两种:

1. 修改一下 @babel/runtime/helpers/typeof.js 文件,内容修改为代码片段的。目的是添加"@babel/helpers - typeof";这一句在代码中,让babel识别出这是一个特殊的helper文件,不对它进行处理。

function _typeof2(o) {
  "@babel/helpers - typeof";
  return (_typeof2 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
      return typeof o;
  } : function(o) {
      return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
  })(o);
}

function _typeof(o) {
  return "function" == typeof Symbol && "symbol" === _typeof2(Symbol.iterator) ? module.exports = _typeof = function(o) {
      return _typeof2(o);
  } : module.exports = _typeof = function(o) {
      return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : _typeof2(o);
  }, _typeof(o);
}

module.exports = _typeof;

2. 参考配置说明 https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html 修改一下 babelSetting 的 outputPath 成其他路径。

 

标签:function,return,微信,typeof4,typeof2,typeof,&&,Symbol
From: https://www.cnblogs.com/xym0710/p/16619064.html

相关文章