Hello everybody, I tried to use this api in an angular app and I get two errors right from the start by running ng serve.
Errors encountered:
ERROR in ./node_modules/tplink-smarthome-api/lib/client.js Module not found: Error: Can't resolve 'dgram'
and
ERROR in ./node_modules/tplink-smarthome-api/lib/client.js Module not found: Error: Can't resolve 'net'
Tested Code:
import { Component } from '@angular/core';
const { Client } = require('tplink-smarthome-api');
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css'],
})
export class AppComponent {
constructor() {
const client = new Client();
// Look for devices, log to console, and turn them on
client.startDiscovery().on('device-new', device => {
device.getSysInfo().then(console.log);
device.setPowerState(true);
});
}
}
I am using an Angular project generated with ng new.
Is there a way to fix this?
Thank you in adavance for any help!
Hello everybody, I tried to use this api in an angular app and I get two errors right from the start by running ng serve.
Errors encountered:
ERROR in ./node_modules/tplink-smarthome-api/lib/client.js Module not found: Error: Can't resolve 'dgram'
andERROR in ./node_modules/tplink-smarthome-api/lib/client.js Module not found: Error: Can't resolve 'net'
Tested Code:
I am using an Angular project generated with
ng new
.Is there a way to fix this? Thank you in adavance for any help!