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

Cannot assign to import "baseApiUrl" #407

Open
Anakii opened this issue Oct 17, 2023 · 3 comments
Open

Cannot assign to import "baseApiUrl" #407

Anakii opened this issue Oct 17, 2023 · 3 comments

Comments

@Anakii
Copy link

Anakii commented Oct 17, 2023

im using Angular version 16,

"ngx-mapbox-gl": "^10.0.0",
  "@types/mapbox-gl": "^2.7.15",
  "mapbox-gl": "^2.15.0",

im initing the map module this way:

import mapboxgl from 'mapbox-gl';
 NgxMapboxGLModule.withConfig({
      accessToken: 'XXXXXXXXX'
    }),

when i builed the project i have this error:

Error: Build failed with 1 error:
node_modules/ngx-mapbox-gl/fesm2022/ngx-mapbox-gl.mjs:105:17: ERROR: Cannot assign to import "baseApiUrl"

i have no idea how to fix this error.
can you help me?

@harellevy
Copy link
Contributor

same here...
Cannot assign to import "baseApiUrl"

node_modules/ngx-mapbox-gl/fesm2022/ngx-mapbox-gl.mjs:105:17:
  105 │         MapboxGl.baseApiUrl = options.customM...
      ╵                  ~~~~~~~~~~

Imports are immutable in JavaScript. To modify the value
of this import, you must export a setter function in the
imported file (e.g. "setBaseApiUrl") and then import and
call that function here instead.

I just have "ngx-mapbox-gl": "^10.0.0", in my package.json... angular 16.

harellevy added a commit to harellevy/ngx-mapbox-gl that referenced this issue Oct 17, 2023
fixing es-build angular 16 build with error
```
Cannot assign to import "baseApiUrl"

    node_modules/ngx-mapbox-gl/fesm2022/ngx-mapbox-gl.mjs:34:25:
      34 │                 MapboxGl.baseApiUrl = options.customMapboxApiUrl;
         ╵                          ~~~~~~~~~~

  Imports are immutable in JavaScript. To modify the value of this import
```
related to evanw/esbuild#891,



fixes:
Wykks#403
Wykks#407
Wykks pushed a commit that referenced this issue Nov 1, 2023
fixing es-build angular 16 build with error
```
Cannot assign to import "baseApiUrl"

    node_modules/ngx-mapbox-gl/fesm2022/ngx-mapbox-gl.mjs:34:25:
      34 │                 MapboxGl.baseApiUrl = options.customMapboxApiUrl;
         ╵                          ~~~~~~~~~~

  Imports are immutable in JavaScript. To modify the value of this import
```
related to evanw/esbuild#891,



fixes:
#403
#407
@MO-Lewis
Copy link

Getting this here too, but on Angular 17. I assumed it was lack of Angular 17 support; weird that it's happening on 16 too: #410

@Skeamy876
Copy link

Hi did anyone find a fix for this issue

denisyilmaz pushed a commit to denisyilmaz/ngx-mapbox-gl that referenced this issue Sep 10, 2024
fixing es-build angular 16 build with error
```
Cannot assign to import "baseApiUrl"

    node_modules/ngx-mapbox-gl/fesm2022/ngx-mapbox-gl.mjs:34:25:
      34 │                 MapboxGl.baseApiUrl = options.customMapboxApiUrl;
         ╵                          ~~~~~~~~~~

  Imports are immutable in JavaScript. To modify the value of this import
```
related to evanw/esbuild#891,



fixes:
Wykks#403
Wykks#407
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