Use JSOM in SPFx with async-await. spfx-jsom takes care of loading the required SP libs.
npm i spfx-jsom --saveimport initSpfxJsom, { ExecuteJsomQuery, JsomContext } from "spfx-jsom";async function getAllWebProperties() {
try {
const jsomCtx: JsomContext = await initSpfxJsom([SITE_URL]);
const webAllProperties = jsomCtx.web.get_allProperties();
await ExecuteJsomQuery(jsomCtx, [{ clientObject: webAllProperties }]);
return webAllProperties.get_fieldValues();
} catch (err) {
throw err;
}
}