I am using Angular 8. This is the NPM library that I want to use : https://www.npmjs.com/package/convert-units
However, it is probably for Node.js, as it seems. Is there any way to make it work in my Angular component?
I am using Angular 8. This is the NPM library that I want to use : https://www.npmjs.com/package/convert-units
However, it is probably for Node.js, as it seems. Is there any way to make it work in my Angular component?
Yes, you definitely can use many of the NPM packages in the browser (Angular, React or any other framework/tech stack).
As for convert-units
package. Just install it using npm install convert-units --save
and then import using either:
const convert = require("convert-units"); // as according to documentation
or
import * as convert from "convert-units"; // to use new ES syntax
As it is a utility package you can use it in node as well as angular. For angular you have to change the import to
import convert from 'convert-units';
First install the npm package as
npm install convert-units --save
Then in your component import as given below
import convert from 'convert-units';
Please find the working stackblitz: https://stackblitz.com/edit/hello-angular-6-u27n5j