-
-
Couldn't load subscription status.
- Fork 192
Open
Description
Seeing this error in my esbuild:
✘ [ERROR] Cannot assign to import "__Process$"
esm:https://esm.sh/*@lightninglabs/[email protected]/esnext/lnc-web.mjs?lp=node_modules%252F%2540lightninglabs%252Flnc-web:4:672:
4 │ ...){o(_())}}}if(__Process$||(__Process$={getuid:()=>-1,getgid:()=>...
╵ ~~~~~~~~~~
Imports are immutable in JavaScript. To modify the value of this import, you must export a setter function in the imported file (e.g. "set__Process$") and then import and call that function here instead.
The package has code that looks like this:
if (!globalThis.process) {
globalThis.process = // ...custom shim
}It's treating process as a global, and assigning it if it doesn't exist, which is valid JavaScript code.
But esm.sh treats it as an import of node:process, and rewrites the code similarly to this:
import process from "node:process";
if (!process) {
process = // custom shim
}This causes the esbuild error: Imports are immutable in JavaScript, and it refuses to bundle the code.
EDIT: This happens because of Go's wasm implementation and affects any package that deals with wasm files compiled with Go. https://go.dev/wiki/WebAssembly
Metadata
Metadata
Assignees
Labels
No labels