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

Imports are immutable in JavaScript - esbuild error #403

Closed
BojanKogoj opened this issue Jul 7, 2023 · 3 comments
Closed

Imports are immutable in JavaScript - esbuild error #403

BojanKogoj opened this issue Jul 7, 2023 · 3 comments

Comments

@BojanKogoj
Copy link

BojanKogoj commented Jul 7, 2023

I'm trying Jest on Angular 16 which uses esbuild, and get the following error

X [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, you must export a setter function i

The issue seems to be this line. Which is weird, because baseApiUrl is already a setter.
The only solution I found was modifying request instead.

Issue for introducing error to esbuild.

Using

  • Angular 16.1.3
  • ngx-mapbox-gl: 10.0.0
  • mapbox-gl: 2.15.0
@harellevy
Copy link
Contributor

Same here...

@Anakii
Copy link

Anakii commented Oct 17, 2023

same for me, also opened an issue #407

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 Wykks closed this as completed in 7942ca3 Nov 1, 2023
@BojanKogoj
Copy link
Author

@Wykks Can you please release a new version with this fix?

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

3 participants