WebGL example seems broken
Describe the Bug
The page of the webGL example seems blank. It shows the following error for me on Firefox 99: (Majaro Linux)
TypeError: _index_bg_wasm__WEBPACK_IMPORTED_MODULE_0__.memory is undefined
<anonymous> webpack:///./pkg/index_bg.js?:434
a https://rustwasm.github.io/wasm-bindgen/exbuild/webgl/index.js:119
<anonymous> webpack:///./pkg/index_bg.js?:1
js https://rustwasm.github.io/wasm-bindgen/exbuild/webgl/pkg_index_js.index.js:28
__webpack_require__ https://rustwasm.github.io/wasm-bindgen/exbuild/webgl/index.js:42
<anonymous> webpack:///./pkg/index_bg.wasm?:53
a https://rustwasm.github.io/wasm-bindgen/exbuild/webgl/index.js:119
<anonymous> webpack:///./pkg/index_bg.wasm?:51
wasm https://rustwasm.github.io/wasm-bindgen/exbuild/webgl/pkg_index_js.index.js:38
__webpack_require__ https://rustwasm.github.io/wasm-bindgen/exbuild/webgl/index.js:42
<anonymous> webpack:///./pkg/index.js?:50
a https://rustwasm.github.io/wasm-bindgen/exbuild/webgl/index.js:119
<anonymous> webpack:///./pkg/index.js?:1
js https://rustwasm.github.io/wasm-bindgen/exbuild/webgl/pkg_index_js.index.js:18
__webpack_require__ https://rustwasm.github.io/wasm-bindgen/exbuild/webgl/index.js:42
promise callback* webpack:///./index.js?:3
js https://rustwasm.github.io/wasm-bindgen/exbuild/webgl/index.js:18
__webpack_require__ https://rustwasm.github.io/wasm-bindgen/exbuild/webgl/index.js:42
<anonymous> https://rustwasm.github.io/wasm-bindgen/exbuild/webgl/index.js:390
<anonymous> https://rustwasm.github.io/wasm-bindgen/exbuild/webgl/index.js:392
If I try to run locally I get the following error:
「wds」: Project is running at http://localhost:8080/
ℹ 「wds」: webpack output is served from /
ℹ 「wds」: Content not from webpack is served from /home/mousetail/wasm-bindgen/examples/webgl
✖ 「wdm」: Error: Rust compilation.
at ChildProcess.<anonymous> (/home/mousetail/wasm-bindgen/examples/webgl/node_modules/@wasm-tool/wasm-pack-plugin/plugin.js:225:16)
at ChildProcess.emit (node:events:527:28)
at maybeClose (node:internal/child_process:1090:16)
at Socket.<anonymous> (node:internal/child_process:449:11)
at Socket.emit (node:events:527:28)
at Pipe.<anonymous> (node:net:709:12)
Steps to Reproduce
- Go to https://rustwasm.github.io/wasm-bindgen/exbuild/webgl/
- See the error in the console
Expected Behavior
- See the rendered example
Actual Behavior
- Blank screen
If applicable, add screenshots to help explain your problem.
Additional Context
Add any other context about the problem here.
Same here in Firefox 100 on Fedora
It doesn't work in Chrome either, but the error is different:
TypeError: Cannot read properties of undefined (reading 'buffer')
at eval (index_bg.js:434:88)
at __webpack_require__.a (index.js:119:13)
at eval (index_bg.js:1:21)
at ./pkg/index_bg.js (pkg_index_js.index.js:28:1)
at __webpack_require__ (index.js:42:42)
at eval (index_bg.wasm:53:55)
at __webpack_require__.a (index.js:119:13)
at eval (index_bg.wasm:51:21)
at ./pkg/index_bg.wasm (pkg_index_js.index.js:38:1)
at __webpack_require__ (index.js:42:42)
I think this could be an issue with the webpack plugin. I'm currently running my own project, not related to WebGL but I'm building using @wasm-tool/wasm-pack-plugin. When I try to run my code in the browser, I get the same error as @jacopofar :
TypeError: Cannot read properties of undefined (reading 'buffer')
at Module.eval (index_bg.js:623:91)
at eval (index_bg.js:627:30)
at ./pkg/index_bg.js (index.js:603:1)
at __webpack_require__ (index.js:64:30)
at eval (index_bg.wasm:8:31)
at ./pkg/index_bg.wasm (index.js:614:1)
at __webpack_require__ (index.js:64:30)
at eval (index.js:2:72)
at ./pkg/index.js (index.js:591:1)
at __webpack_require__ (index.js:64:30)
I think that's caused by #2961, so it should be fixed with the git version of wasm-bindgen.