Including External Scripts With Global References Using Webpack
I am working on using Webpack 2 to package some oldish javascript code. This code uses the Leaflet 1.0 library and also includes a Leaflet plugin (named Google.js) that simply refe
Solution 1:
I just tried a very simple webpack project using Leaflet.GridLayer.GoogleMutant instead, and it works like a charm:
import'leaflet';
import'leaflet.gridlayer.googlemutant';
varmap = L.map('map').setView([0,0],0);
var roadMutant = L.gridLayer.googleMutant({
maxZoom: 24,
type:'roadmap'
}).addTo(map);
That will work as long as you reference the GMaps JS API in a separate <script>
in your HTML. And npm install leaflet leaflet.gridlayer.googlemutant
, of course.
Post a Comment for "Including External Scripts With Global References Using Webpack"