-
-
Notifications
You must be signed in to change notification settings - Fork 691
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
workerUrl for csp not working in esbuild #1550
Comments
We'll need more info in order to understand what you mean... Please provide code pen of both options. |
Thanks @HarelM So MapBox has: https://docs.mapbox.com/mapbox-gl-js/api/properties/#workerclass It is specifically designed to do what I am saying. We use esbuild, and the distribution you have of the https://unpkg.com/browse/maplibre-gl@2.3.0/dist/maplibre-gl-csp.js Only ships an IFFE / UMD version. It would be better if you could distribute multiple package formats, so we can slowly move to ESM. Here, there is a thread describing why. It breaks ESM principles to use the gl.workerUrl = "" method of setting. The other alternative is to provide another way to set the worker url or worker class without the = assignment, so it can work with ESM bundlers. esbuild is a huge player in the space today. |
The way to reproduce this is to simply try to use the sample csp mgl.workerUrl= "" method in a project that uses esbuild. Anyone will hit this error. |
This is still to vague. Can you please create a stackblitz reproduction? |
After review, I found that if you import it via:
it works. But if you do this:
It doesn't. |
Hi,
esbuild yells at us if we try to do
maplibregl.workerUrl = "path/to/worker.js"
"cannot assign to import"
It looks like MapBoxGL lets you assign a workerclass instead of a url. Can yours do that?
The text was updated successfully, but these errors were encountered: