Closed nickforddev closed 6 years ago
Hi Nick,
Thanks for the suggestion, that is much cleaner than requiring Mapbox GL JS globally. I tried out the shimming and it works great, so I just updated the docs to suggest using Webpack shimming. Feel free to submit a PR if you want to add any other details.
Cheers, Pete
I found the documentation to be lacking for including
mapbox-gl
as a global with Webpack or other transpilers. The suggestion to usewindow.mapboxgl = require('mapbox-gl')
doesn't really work for people using ES6 modules, because it must be included before importingvue-mapbox-gl
. Including it in the root js file may work, but I have another suggestion:I think the cleanest solution is to use shimming, as documented here https://webpack.js.org/guides/shimming/. Maybe a link to this in the docs would make it easier for others using ES6 modules who aren't satisfied binding to
window.mapboxgl
in their root js file.I'd be happy to submit a PR, if you'd like. Thanks!