I am using mapbox gl's csp distribution. Instead of using the script tag, I am using its node module.
After importing the mapbox gl, I tried to set its workerUrl in my index.ts:
mapboxgl["workerUrl"] = "https://api.mapbox.com/mapbox-gl-js/v1.10.1/mapbox-gl-csp-worker.js";
(I am using the bracket notation instead of mapboxgl.workerUrl because I got Error: Illegal reassignment to import from rollup.) When I loaded my example code on chrome, I got the following error:
Uncaught (in promise) DOMException: Failed to construct 'Worker': Script at 'https://api.mapbox.com/mapbox-gl-js/v1.10.1/mapbox-gl-csp-worker.js' cannot be accessed from origin 'null'.
When I ran the code from localhost on chrome, I still got the following error:
Uncaught (in promise) DOMException: Failed to construct 'Worker': Script at 'https://api.mapbox.com/mapbox-gl-js/v1.10.1/mapbox-gl-csp-worker.js' cannot be accessed from origin 'http://127.0.0.1:8887'.
When I ran the code from localhost on firefox, I got the following error:
Security Error: Content at http://localhost:8080/dist/2.0/examples/example.html may not load data from https://api.mapbox.com/mapbox-gl-js/v1.10.1/mapbox-gl-csp-worker.js.
Is this a known issue in mapbox or am I missing anything? Thank you!