I need to use some library to manage currencies (add, sum, floating point, etc.) in Adonis.js v4.
I found different libraries that should work (Diner.js, currency.js, money.js), but I am unable to use those libraries with Adonis.
For example with currency.js, I install it with npm
npm install --save currency.js
and then inside the controller I tried to use it with:
const currency = require('currency.js') //nada, but if I click on it it redirects me to the node modules folder
const currency = use('currency.js') //nada
const currency = require('currency.js/dist') //nada
const currency = require('currency.js/dist/currency.js') //nada
It always shows this error:
Cannot find module 'currency.js' Require stack: - /srv/app/app/Controllers/Http/Common/AccountTransactionController.js - /srv/app/node_modules/require-stack/src/index.js - /srv/app/node_modules/require-stack/index.js - /srv/app/node_modules/@adonisjs/fold/src/Ioc/index.js - /srv/app/node_modules/@adonisjs/fold/index.js - /srv/app/server.js
I tried with the other two libraries and it's the same. Can you please help me import and use this/those library/libraries?