121312414
###creator 2.0.10趟坑完毕,因为es6的原因,会出现require(“gogogle_protobuf”)错误的原因,解决方案如下:
####1.google_protobuf.js 导入项目时不导入为插件
####2.google_protobuf.js 最后行中修改将
module.exports.goog = goog;
module.exports.jspb = jspb;
module.exports.COMPILED = COMPILED;
修改为:
export {goog, jspb, COMPILED }
####3.再*_pg.js文件将
var jspbcomp = require(‘google-protobuf’);
var COMPILED = jspbcomp.COMPILED;
var jspb = jspbcomp.jspb;
var goog = jspbcomp.goog;
修改为:
import {COMPILED, jspb, goog} from “google-protobuf”;
然后就可以正常使用了,感谢楼主分享
1赞
mark!
mark protobuf
能分享下你c++ 与cocos creator protobuf 通信的例子吗