Trying to work with react-map-gl but can't get the simplest lib example to work. I have only a gray background with mapbox logo on it. As soon as I try to render the map component I get this weird error in console which 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
I'm on a Rails 6 app with webpack and I have 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"
}
Do you have any clue of what is happening ?
Solved it thank to this well documented PR: https://github.com/lewagon/rails-templates/pull/81
// config/webpacker/environment.js
const { environment } = require('@rails/webpacker');
// Preventing Babel from transpiling NodeModules packages
environment.loaders.delete('nodeModules');
module.exports = environment;
Most helpful comment
Solved it thank to this well documented PR: https://github.com/lewagon/rails-templates/pull/81