[LayaAir 2.0]laya2.0引入第三方库失败
在laya2.0中按照laya1.0同样的方式,将第三方库pb2.js文件放入了bin/libs目录下,pb2.d.ts文件放入libs目录下,并在index.js里loadLib("libs/pb2.js")。
编译报错:
Error: Cannot find module '../../libs/pb2' from 'E:\myLaya2D\src\script'
at D:\Program Files\LayaAirIDE2.0\resources\app\node_modules\browser-resolve\node_modules\resolve\lib\async.js:55:21
at load (D:\Program Files\LayaAirIDE2.0\resources\app\node_modules\browser-resolve\node_modules\resolve\lib\async.js:69:43)
at onex (D:\Program Files\LayaAirIDE2.0\resources\app\node_modules\browser-resolve\node_modules\resolve\lib\async.js:92:31)
at D:\Program Files\LayaAirIDE2.0\resources\app\node_modules\browser-resolve\node_modules\resolve\lib\async.js:22:47
at FSReqWrap.oncomplete (fs.js:114:15)
编译报错:
Error: Cannot find module '../../libs/pb2' from 'E:\myLaya2D\src\script'
at D:\Program Files\LayaAirIDE2.0\resources\app\node_modules\browser-resolve\node_modules\resolve\lib\async.js:55:21
at load (D:\Program Files\LayaAirIDE2.0\resources\app\node_modules\browser-resolve\node_modules\resolve\lib\async.js:69:43)
at onex (D:\Program Files\LayaAirIDE2.0\resources\app\node_modules\browser-resolve\node_modules\resolve\lib\async.js:92:31)
at D:\Program Files\LayaAirIDE2.0\resources\app\node_modules\browser-resolve\node_modules\resolve\lib\async.js:22:47
at FSReqWrap.oncomplete (fs.js:114:15)
没有找到相关结果
已邀请:
1 个回复
rabbit
赞同来自: karin666 、李家智
pb2.d.ts和protobufjs.d.ts也有问题,别用export as namespace 用 declare module
代码已改。下载改后的项目你试试。