egret发布到微信小游戏的一些坑

  1. 自定义控件没找到,需要到控件类里加一句代码:
window["ClassName"] = window["ClassName"] || ClassName;
  1. 引入第三方库找不到,将原有的
 /* AMD */ if (typeof define === 'function' && define["amd"])
     define(["long"], factory);
 /* CommonJS */ else if (typeof require === 'function' && typeof module === "object" && module && module["exports"])
     module['exports'] = (function() {
         var Long; try { Long = require("long"); } catch (e) {}
         return factory(Long);
     })();
 /* Global */ else
     (global["dcodeIO"] = global["dcodeIO"] || {})["ByteBuffer"] = factory(global["dcodeIO"]["Long"]);

改成

global = global || window;
(global["dcodeIO"] = global["dcodeIO"] || {})["ByteBuffer"] = factory(global["dcodeIO"]["Long"]);

你可能感兴趣的:(egret)