问题
I am trying to use the Google Maps Javascript Api V3 inside a Angular + browserify app.
I do not use bower.
Previously I was doing that with requirejs, and a plugins on git hub millermedeiros/requirejs-plugins called async.
I was able to load gmaps like this (most of the time, sometimes requirejs was still requireing gmaps too early.
 // load gmap as an amd module
 define(['config'], function(config){
     define('gmaps', ['async!http://maps.google.com/maps/api/js?v=3&sensor=false&libraries=places&key=' + config['google-map-api-key']],
         function(){
             return window.google.maps;
         }
     );
 });
Browserify is kind of new, I don't see much documentation at this moment, do you guys have any recommendation ?
回答1:
To include CommonJS incompatible scripts have a look at Browserify-shim transform:
https://github.com/thlorenz/browserify-shim
来源:https://stackoverflow.com/questions/26700665/using-google-maps-api-v3-with-angular-and-browserify