Using Google Map as a baselayer in JS API 4.X

Blog Post created by hzhu on May 16, 2017

ESRI has posted a script, i believed back 5 years ago, to us google map as a base layer. The script works fine for JS API  3.x version with a little modification. Since API 4.X, the libraries are rewritten and the script no longer worked for the API 4.x. Recently i was working on a public facing web app and one requirement is to replace the ESRI base maps with google maps while keep other API functions like search and query etc. So I spend a little time and wrote a little script so JS API 4.x can use Google map base map as one option. The script is very simple and I would love to share with peels. If anyone has written such scripts and would like to exchange or discuss it, I would very happy to do so.