'MapboxDraw' is not defined
whittakergroupinc opened this issue · comments
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);
}
}
});`
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);
}
}
});