function loadScript() {  
  const GOOGLE_MAPS_API_KEY = YOUR_API_KEY || process.env.GoogleMapsAPIKey,
        GOOGLE_MAPS_API_URI = `https://maps.googleapis.com/maps/api/js?key=${GOOGLE_MAPS_API_KEY}&libraries=places`,
        HEAD = document.querySelector('head'),
        SCRIPT = document.createElement('script');

  SCRIPT.type = 'text/javascript';
  SCRIPT.src = GOOGLE_MAPS_API_URI;
  HEAD.appendChild(SCRIPT);
  return new Promise(resolve => {
    SCRIPT.onload = resolve;
  });
}
// Load the Google Maps Platform JS API async
Load the Google Maps Platform JS API async
Load the Google Maps Platform JS API async
function loadScript() {  
  const GOOGLE_MAPS_API_KEY = YOUR_API_KEY || process.env.GoogleMapsAPIKey,
        GOOGLE_MAPS_API_URI = `https://maps.googleapis.com/maps/api/js?key=${GOOGLE_MAPS_API_KEY}&libraries=places`,
        HEAD = document.querySelector('head'),
        SCRIPT = document.createElement('script');
  SCRIPT.type = 'text/javascript';
  SCRIPT.src = GOOGLE_MAPS_API_URI;
  HEAD.appendChild(SCRIPT);
  return new Promise(resolve => {
    SCRIPT.onload = resolve;
  });
}
function loadScript ( ) { const GOOGLE_MAPS_API_KEY = YOUR_API_KEY || process . env . GoogleMapsAPIKey , GOOGLE_MAPS_API_URI = ` ${ GOOGLE_MAPS_API_KEY } ` , HEAD = document . querySelector ( 'head' ) , SCRIPT = document . createElement ( 'script' ) ; SCRIPT . type = 'text/javascript' ; SCRIPT . src = GOOGLE_MAPS_API_URI ; HEAD . appendChild ( SCRIPT ) ; return new Promise ( resolve => { SCRIPT . onload = resolve ; } ) ; }
Load the Google Maps Platform JS API async
Load the Google Maps Platform JS API async