2

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.

2 Answers2

2

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.

Dan Selman
  • 2,287
  • 2
  • 9
  • 18
1

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

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 .

enter image description here

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

3/ Result using playground

Result using playground

4/ Result using composer-rest-server

Result using composer-rest-server

tlejmi
  • 526
  • 8
  • 13