mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 18:46:40 -05:00
Fix azdata API check when webpacked (#16505)
This commit is contained in:
@@ -54,6 +54,10 @@ export function getPackageInfo(packageJson: any): IPackageInfo | undefined {
|
|||||||
let azdataApi: typeof azdataType | undefined = undefined;
|
let azdataApi: typeof azdataType | undefined = undefined;
|
||||||
try {
|
try {
|
||||||
azdataApi = require('azdata');
|
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 {
|
} catch {
|
||||||
// no-op
|
// no-op
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -367,6 +367,10 @@ export function timeConversion(duration: number): string {
|
|||||||
let azdataApi: typeof azdataType | undefined = undefined;
|
let azdataApi: typeof azdataType | undefined = undefined;
|
||||||
try {
|
try {
|
||||||
azdataApi = require('azdata');
|
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 {
|
} catch {
|
||||||
// no-op
|
// no-op
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user