Can I use JavaScript libs with require on transaction processor

∥☆過路亽.° 提交于 2019-12-18 09:18:32

问题


Can I use JavaScript libs with require on transaction processor of fabric composer? I'd like to use it with npm install.. at least I couldn't do this on playground now.


回答1:


No, we do not support that. We have tentative plans to move to native Node.js chain code container, which may allow this. It does raise some challenges around lifecycle management of the code however.




回答2:


I have tried to use momentjs and numeraljs in my project . Since i can use many logic js file in my model .

I have decided to add numeral.js and moment.js in the lib folder with my logic.js .

1/ Moment.js and numeral.js in lib file

later , i call them directly without using require or import and disable eslint undefined

// eslint-disable-next-line no-undef

2/ Example of using momentjs and numeraljs in user.js as my logic javascript file .

Here is the result in playground and composer-rest-server

3/ Result using playground

4/ Result using composer-rest-server



来源:https://stackoverflow.com/questions/44688828/can-i-use-javascript-libs-with-require-on-transaction-processor

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!