After upgrading to angular 13, I encountered a problem that was not present when using angular 10.
In my TwilioSyncService
, the require
statement is included in the constructor because it is an Injectable service requirement.
The code snippet shows how the syncClientclass
is instantiated:
export class TwilioSyncService{
constructor(private http: HttpClient, private router: Router){
//@ts-ignore
this.syncClientclass = require('twilio-sync');
}
syncClientclass;
syncClient;
This instance is then used in the following function:
connect(token){
this.syncClient = new this.syncClientclass(token);
this.sendSyncClient(this.syncClient);
}
According to the Twilio Sync documentation, this approach is correct:
var SyncClient = require('twilio-sync');
var syncClient = new SyncClient(token);
You can find more information in the linked documentation.