I'm trying to build an Angular project where I have 3 files - getComputers.js, getIps.js and one typescript file - app.ts. I need to require a trendmicro module in both Javascript files. For one file it works but for the other it throws a module not found error.
I ran the following line to link the trendmicro module to my project.
yarn link "@trendmicro/deepsecurity"
It gets successfully linked. The problem shows up for getIps.js and doesn't show up for getComputers.js, here is what I tried:
getComputers.js
function getThoseComps(p1,p2)
{
return new Promise((resolve, reject) => {
const api = require("@trendmicro/deepsecurity"); //This works
//...other code
});
}
getIps.js
function getIPS(p3,p4)
{
return new Promise((resolve, reject) => {
const api = require("@trendmicro/deepsecurity"); //This throws error...
//...other code
});
}
app.ts
import { getThoseComps } from "../../assets/js/geComputers.js"
import { getIPS } from "../../assets/js/getIps.js";
@Component({
selector: 'app-home',
templateUrl: './home.component.html',
styleUrls: ['./home.component.scss']
})
export class HomeComponent implements OnInit {
async fetchComputers() {
try {
const obj1 = await getThoseComps(p1,p2); // This works perfect
const obj2 = await getIPS(p3,p4); // This causes error...
}
catch(err) {
console.log(err);
}
}
ngOnInit()
{
this.fetchComputers();
}
}
Edit:
ERROR in /home/hd/Downloads/dsm-js-sdk/src/index.js
Module not found: Error: Can't resolve 'ApiClient' in '/home/hd/Downloads/dsm-js-sdk/src'
ERROR in /home/hd/Downloads/dsm-js-sdk/src/index.js
Module not found: Error: Can't resolve 'api/APIKeysApi' in '/home/hd/Downloads/dsm-js-sdk/src'
ERROR in /home/hd/Downloads/dsm-js-sdk/src/index.js
Module not found: Error: Can't resolve 'model/WebReputationRights' in '/home/hd/Downloads/dsm-js-sdk/src'
ERROR in /home/hd/Downloads/dsm-js-sdk/src/index.js
Module not found: Error: Can't resolve 'model/WeeklyScheduleParameters' in '/home/hd/Downloads/dsm-js-sdk/src'
ERROR in /home/hd/Downloads/dsm-js-sdk/src/index.js
Module not found: Error: Can't resolve 'model/WorkspaceVirtualMachineSummary' in '/home/hd/Downloads/dsm-js-sdk/src'
ℹ 「wdm」: Failed to compile.
Note: The error shows up for index.js which according to me is misleading becuase the same error doesn't show up when I require trendmicro module in getComputers.js file. The dsm-js-sdk folder contains that module.