Open
Description
Describe the bug
WASM in the browser works nicely in HeadLamp. However, bigger WASM files do not load correctly.
To Reproduce
Create a Golang WASM module
Add dependencies so that the resulting WASM file becomes bigger than 64 MB
Run the code to load the WASM file, see https://golangbot.com/webassembly-using-go/#indexhtml
Observe that the import fails with odd errors such as 'panic: syscall/js: call of Value.Int on undefined'
Environment (please provide info about your environment):
- Headlamp in cluster has issues with larger WASM files
- Headlamp in dev mode (npm run start) has issues with larger WASM files
- Headlamp Windows Desktop does NOT have issues with larger WASM files
- Headlamp Version: 25
What else did you test?
Headlamp uses the plugin vite-plugin-node-polyfills. Somehow the node.js polyfill seems to have impact on importing the WASM file.
We tested the following scenario:
- create a new app with
create-vite
- add code in this app to load a WASM file on startup of the app
- put the WASM file in the public folder. Make sure the WASM file is larger than 64 MB.
- run the app
- Observe: the WASM loads correctly
- Now add the plugin vite-plugin-node-polyfills.
- Add the following to vite.config.ts:
plugins:
nodePolyfills({
include: ["process", "stream", "buffer"],
}),
- run the app
- Observe: the WASM fails to load
Are you able to fix this issue?
No, but I can help to reproduce the issue and validate fixes.
Metadata
Metadata
Assignees
Type
Projects
Status
Queued