Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mapbox在13.4的iapd中不显示,用了mapbox-gl-csp-worker报错 #10615

Closed
Hwuli opened this issue Apr 24, 2021 · 2 comments
Closed

mapbox在13.4的iapd中不显示,用了mapbox-gl-csp-worker报错 #10615

Hwuli opened this issue Apr 24, 2021 · 2 comments

Comments

@Hwuli
Copy link

Hwuli commented Apr 24, 2021

Hello! Thanks for contributing.
open in iPad error : An error occurred while parsing the WebWorker bundle. This is most likely due to improper transpilation by Babel;

then add in my project:
import mapboxgl from 'mapbox-gl/dist/mapbox-gl';
import MapboxWorker from 'mapbox-gl/dist/mapbox-gl-csp-worker';
mapboxgl.workerClass = MapboxWorker;

will error Fr.workerClass is not a constructor

Thanks

@AlexanderArce
Copy link

AlexanderArce commented May 11, 2021

I had the same issue but i managed to fix it by adding the worker loader to the webpack config. I'm using an ejected Create React App, this is what I did:

 module: {
      rules: [
        {
          test: /\bmapbox-gl-csp-worker.js\b/i,
          loader: 'worker-loader',
          options: { inline: 'fallback' },
        },
}

I needed the inline fallback option because I was exporting the component as a CDN, so you'll probably don't need it.

I also installed the worker-loader in my package.json.

@karimnaaji
Copy link
Contributor

@Hwuli was the above useful? What specific version are you using?

@arindam1993 is this somewhat related to #10565?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants