deep-equal 2.0.5 lib integration with Angular 10

342 views Asked by At

I'm trying to integrate latest version of deep-equal with angular application (v10). I added deep-equal version 2.0.5 as "dependency" in package.json (Assuming if this library is dependant on other libs, npm will auto download required dependencies). Also added @types/deep-equal to package.json file.

To use deep-equal, I added node_modules path in Scripts array in Angular.json:

 "scripts": ['./node_modules/deep-equal/index.js']

When I import deep-equal to my angular service to use the method in following ways:

import * as deQ from 'deep-equal';
import * as deep-equal from 'deep-equal';
import { deep-equal } from 'deep-equal';

But no luck.

My angular application starts giving error as require and global is not defined (from index.js file of deep-equal library).

Let me know if I'm missing anything or if I need to add other libs as dependency. I'm not explicitly adding require as dependency because Angular has its own Dependency-injection framework.

PS: The below SO link related to my question doesn't solve the problem, because it uses deep-equal ver 1.0.1 and I'm trying to use the latest version: How to use deep-equal (Angular 7)

0

There are 0 answers