Hey, y'all.
I've been playing with the library this afternoon. I supplied my component with all of its props but nothing gets displayed. Anyone know what might be wrong?
<StaticMap
width={400}
height={400}
zoom={8}
onLoad={(a) => console.log('loaded', a)}
onError={(e) => console.log('error!', e)}
latitude={37.805}
longitude={-122.447}
mapStyle="mapbox://styles/mapbox/dark-v9"
mapboxApiAccessToken='...'
/>
I get no errors, or anything, so I have no idea what is going wrong. Trying to render this map on an Electron app.
I have the same issue - using a pretty bare app right now with fuse-box as the bundler, no network requests are firing off to MapBox so I feel like the MapBox sdk isn't being initialized/started. Testing the InteractiveMap's onLoad function isn't invoked either, so I suspect this is true
Using the MapBox SDK directly works fine
Can you try run the basic example here: https://github.com/uber/react-map-gl/tree/4.1-release/examples/exhibit-webpack
same here. webpack example works in Chrome, not working in Electron
After two days of playing around with different electron-react boilerplates and _react-map-gl_, we finally found the issue creating the problem described above for us.
In our _webpack.config.js_ we had a line to exclude node modules from being bundled:
externals: [...Object.keys(dependencies || {})]
Apparently, _react-map-gl_ expect to be bundled (?) so we excluded it from the array:
externals: [...Object.keys(dependencies || {}).filter(x => x !== 'react-map-gl')] and voila we get the map in our electron map.
@saschahofmann
Hope this works, i'll test it later. thx!
@Pessimistress i am having the same issue, the webpack workaround doesn't help
Most helpful comment
After two days of playing around with different electron-react boilerplates and _react-map-gl_, we finally found the issue creating the problem described above for us.
In our _webpack.config.js_ we had a line to exclude node modules from being bundled:
externals: [...Object.keys(dependencies || {})]Apparently, _react-map-gl_ expect to be bundled (?) so we excluded it from the array:
externals: [...Object.keys(dependencies || {}).filter(x => x !== 'react-map-gl')]and voila we get the map in our electron map.