Fix azdata API check when webpacked (#16505)

This commit is contained in:
Charles Gagnon
2021-07-30 16:06:50 -07:00
committed by GitHub
parent 3362462142
commit a7c1bcaf93
2 changed files with 8 additions and 0 deletions

View File

@@ -367,6 +367,10 @@ export function timeConversion(duration: number): string {
let azdataApi: typeof azdataType | undefined = undefined;
try {
azdataApi = require('azdata');
if (!azdataApi?.version) {
// webpacking makes the require return an empty object instead of throwing an error so make sure we clear the var
azdataApi = undefined;
}
} catch {
// no-op
}