Babel 编译问题

  1. 目前编译后的代码只进行了语法转换,一些新的数据结构比如Set,并没有Polyfill,怎么设置包含Polyfill啊?
    因为我看到 cocos analytics有零星的
    Set is not defined,
    Array.from is not a function
    Object.values is not a function
    a.findIndex is not a function 之类的错误
  2. 一些类是用class 这种方式写的。我看Babel 编译后的一些辅助函数每个文件里都有一份,这个可以配置成全局函数只有一份吧。

  1. Cannot convert object to primitive value,
    这种错误除去这种还有什么情况可以引起?
    const obj = Object.create( null ) // cc.js.createMap(true); obj.t = 11; console.log("test" + obj);