I have my angular 18 application running with SSR.
I have the following import which fails on page load as the igv.js file contains client-side objects like window
, etc:
import * as igv from 'igv';
I need to dynamically import the javascript file on the client-side so that it doesn’t fail with the SSR.
I tried the code below but am getting the error message TypeError: igv.createBrowser is not a function,
if (isPlatformBrowser(this.platformId)){
const promise = import("/Users/Projects/angular-project/igv.js");
promise.then(igv=> {
try {
this.browser = igv.createBrowser(this.igvDiv.nativeElement, this.options);
} catch (e) {
console.log(e);
}
});
}
Any idea how to dynamically load the igv module on client-side?