urbica / react-map-gl

React Component Library for Mapbox GL JS
https://urbica.github.io/react-map-gl/
MIT License
416 stars 51 forks source link

The map does not appear #329

Open homerokzam opened 3 years ago

homerokzam commented 3 years ago

Describe the bug An error occurred while parsing the WebWorker bundle. This is most likely due to improper transpilation by Babel; please see https://docs.mapbox.com/mapbox-gl-js/api/#transpiling-v2

The error started to happen after updating the @urbica/react-map-gl lib

To Reproduce Occurs only after publishing to server (docker). Running locally the error does not occur.

Screenshots

Screen Shot 2021-06-01 at 16 06 57

Desktop (please complete the following information):

franciscoarruda commented 3 years ago

I have the same problem

franciscoarruda commented 3 years ago

I found a way to fix the problem:

npm i worker-loader

Then:

import mapboxgl from 'mapbox-gl';

export default function Map() {

mapboxgl.workerClass = require('worker-loader!mapbox-gl/dist/mapbox-gl-csp-worker').default;

...

LewAndrade commented 3 years ago

I stumbled upon the same issue, my production app is hosted on AWS S3, and only there the error occurs. I couldn't figure out how you solved the error, could you help me? I'm using react-map-gl v5.2.0.