Open vladyslav-semenets opened 2 years ago
@VladislavSemenets Try changing the target in tsconfig.json from 'es5' to 'es2015'.
@rajarajankamban @VladislavSemenets
I too am facing the same issue. I tried just about everything so far with no luck. Any solution or workround ?
Use target as 'es5'. Remove all your maxbox-gl imports across components.
Now added the below in angular.json. So that you avoid using es6 version of it.
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"allowedCommonJsDependencies": ["mapbox-gl",]
},
"scripts":["node_modules/mapbox-gl/dist/mapbox-gl.js"]
}
}
In the component where you want to use mapbox-gl
import { Component ... } from "@angular/core";
.
.
declare const mapboxgl: any;
@Component({
...
})
export class Component{
_mapboxgl: any = mapboxgl;
map:any;
buildMap(){
this.map = new this._mapboxgl.Map({
container: 'map'
....
})
}
}
Hey there. Facing the same, is there any solution yet?
Heya guys, how to fix this error:
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/guides/install/#transpiling