phegman / vue-mapbox-gl

A Vue.js component for Mapbox GL JS
GNU General Public License v3.0
270 stars 33 forks source link

'MapboxDraw' is not defined #44

Closed whittakergroupinc closed 6 years ago

whittakergroupinc commented 6 years ago

Im getting 'MapboxDraw' is not defined when using the code snippet provided. Any ideas where I may be going wrong?

`import Mapbox from 'mapbox-gl-vue'; const app = new Vue({ el: '#app', components: { Mapbox }, methods: { mapInitialized(map) { const Draw = new MapboxDraw();

  map.addControl(Draw);
}

} });`

whittakergroupinc commented 6 years ago

NVM! I figured it out...

npm install @mapbox/mapbox-gl-draw --save if using webpack add to webpack.config: node: { fs: "empty" }

Then import Mapbox from 'mapbox-gl-vue'; import MapboxDraw from '@mapbox/mapbox-gl-draw'

const app = new Vue({ el: '#app', components: { Mapbox }, methods: { mapInitialized(map) { const Draw = new MapboxDraw();

  map.addControl(Draw);
}

} });