As mentioned in the user guide, you need to explicitly read any global variables from window
. Put this at the top of the file and it will work:
const google = window.google;
The reason we enforce this is because people commonly misunderstand the difference between local variables, imported modules, and global variables, and so we want to always make it clear in the code when you use a global variable.
By the way, this is not related to Webpack or HTTPS. You see this because we use a linting rule that forbids unknown global variables.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…