Trying to work with react-map-gl
but can't get the simplest lib example to work. As soon as I try to render the map I get this weird error in console I'm unable to understand:
Uncaught ReferenceError: _typeof is not defined
at mr (blob:http://localhos…6-19b5d5c80288:4993)
at blob:http://localhos…6-19b5d5c80288:6740
at new Fn (blob:http://localhos…6-19b5d5c80288:6757)
at new Jn (blob:http://localhos…6-19b5d5c80288:7040)
at blob:http://localhos…6-19b5d5c80288:8992
at blob:http://localhos…-19b5d5c80288:14153
Sometimes it changes to this:
Uncaught ReferenceError: _typeof is not defined
at mr (0bcc60f9-25f2-4a56-8906-ebd57645a06c:4993)
at 0bcc60f9-25f2-4a56-8906-ebd57645a06c:6740
at new Fn (0bcc60f9-25f2-4a56-8906-ebd57645a06c:6757)
at new Jn (0bcc60f9-25f2-4a56-8906-ebd57645a06c:7040)
at 0bcc60f9-25f2-4a56-8906-ebd57645a06c:8992
at 0bcc60f9-25f2-4a56-8906-ebd57645a06c:14153
The map frame with mapbox logo renders but nothing else.
I'm on Rails 6 with those packages:
"dependencies": {
"@babel/preset-react": "^7.0.0",
"@rails/actioncable": "^6.0.0-alpha",
"@rails/activestorage": "^6.0.0-alpha",
"@rails/ujs": "^6.0.0-alpha",
"@rails/webpacker": "^4.0.7",
"babel-plugin-transform-react-remove-prop-types": "^0.4.24",
"prop-types": "^15.7.2",
"react": "^16.9.0",
"react-dom": "^16.9.0",
"react-map-gl": "^5.0.10"
}
My code :
import React, { Component } from 'react';
import ReactMapGL from 'react-map-gl';
import 'mapbox-gl/dist/mapbox-gl.css';
class Map extends Component {
state = {
viewport: {
latitude: 20.827873989993776,
longitude: -73.86145304236818,
zoom: 3,
},
};
render() {
return (
<ReactMapGL
mapboxApiAccessToken={[TOKEN]}
{...this.state.viewport}
onViewportChange={viewport => this.setState({ viewport })}
/>
);
}
}
export default Map;
Googled the error the whole afternoon but found nothing.