-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
How can I turn off 'Cannot assign to import" If libs contain it? #891
Comments
Subscribe, have a same problem. |
OH, i have a same problem too. Will watch what to do. I wanna write my webpack project to esbuild. |
This problem was blocking me, I had to go back to webpack |
It is not possible to turn this off. This is not valid ECMAScript module code. Properties of an imported module namespace object cannot be assigned to in ECMAScript. Here's an example of trying to do this in node:
This bundler follows ECMAScript semantics just like node, so if your code uses ECMAScript module syntax and doesn't run in node, then it likely won't run in esbuild either. I think you will likely have to go back to Webpack to be able to use this library. |
You could work around it by importing the non-ESM version of the library doing this, or transform it to CommonJS and then import the CommonJS version and esbuild will transform it back |
Yes, that's a good point. This module ships with broken ESM code but esbuild is only loading it because it's respecting the |
I'm going to close this because I think the above answers should be sufficient. Feel free to add additional comments if you have additional thoughts. |
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
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
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
The text was updated successfully, but these errors were encountered: