question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

WebAssembly with Reference Types cannot be parsed

See original GitHub issue

Reopened #13559

Bug report

WebAssembly modules with enabled Reference Types cannot be loaded. The webpack version I tested this with is 5.38.1

For a minimal reproduction I created this repository: https://github.com/Tarnadas/webpack-5-wasm-reftypes

The error message is the following:

ERROR in ./pkg/webpack_5_wasm_reftypes_bg.wasm
Module parse failed: Internal failure: parseVec could not cast the value
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
Error: Internal failure: parseVec could not cast the value
    at new CompileError (/home/marior/projects/webpack-5-wasm-reftypes/node_modules/@webassemblyjs/helper-api-error/lib/index.js:40:109)
    at parseVec (/home/marior/projects/webpack-5-wasm-reftypes/node_modules/@webassemblyjs/wasm-parser/lib/decoder.js:328:15)
    at parseTypeSection (/home/marior/projects/webpack-5-wasm-reftypes/node_modules/@webassemblyjs/wasm-parser/lib/decoder.js:360:22)
    at parseSection (/home/marior/projects/webpack-5-wasm-reftypes/node_modules/@webassemblyjs/wasm-parser/lib/decoder.js:1363:24)
    at Object.decode (/home/marior/projects/webpack-5-wasm-reftypes/node_modules/@webassemblyjs/wasm-parser/lib/decoder.js:1712:25)
    at decode (/home/marior/projects/webpack-5-wasm-reftypes/node_modules/@webassemblyjs/wasm-parser/lib/index.js:248:21)
    at WebAssemblyParser.parse (/home/marior/projects/webpack-5-wasm-reftypes/node_modules/webpack/lib/wasm-async/AsyncWebAssemblyParser.js:48:19)
    at /home/marior/projects/webpack-5-wasm-reftypes/node_modules/webpack/lib/NormalModule.js:1018:26
    at processResult (/home/marior/projects/webpack-5-wasm-reftypes/node_modules/webpack/lib/NormalModule.js:745:11)
    at /home/marior/projects/webpack-5-wasm-reftypes/node_modules/webpack/lib/NormalModule.js:809:5
 @ ./pkg/webpack_5_wasm_reftypes.js 1:0-58 4:0-21
 @ ./src/index.js 1:0-16

webpack 5.38.1 compiled with 1 error in 572 ms
error Command failed with exit code 1.

I used Rust with wasm-bindgen, which provides a cli option to enable reference types. Instead of directly using wasm-bindgen, I’ve been using wasm-pack, but since it’s unmaintained, you will need my fork to pass the cli option down to wasm-bindgen. You can see my PR for wasm-pack here: rustwasm/wasm-pack#888

By looking at the error message, it seems to be a problem with the wasm parser library. I checked its repository and couldn’t find any mentions about reference types unfortunately, so I’m not sure how to proceed with this.

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:1
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
webpack-botcommented, Oct 22, 2022

Issue was closed because of inactivity.

If you think this is still a valid issue, please file a new issue with additional information.

0reactions
CryZecommented, Oct 22, 2022

Last time you at least gave a warning, and it’s marked as completed?? This has to be the worst bot ever.

Read more comments on GitHub >

github_iconTop Results From Across the Web

WebAssembly with Reference Types cannot be parsed #13559
Bug report WebAssembly modules with enabled Reference Types cannot be loaded. The webpack version I tested this with is 5.38.1 For a minimal ......
Read more >
RFC: WebAssembly Reference Types in Clang
Since reference types cannot be stored to linear memory there's another structure allowing us to store these types: tables.
Read more >
Improving Webassembly and Its Tooling - InfoQ
It will never generate an input that fails to parse, reference an undefined variable, or incorrectly add an integer and a float together....
Read more >
Firefox 79 now supports WebAssembly threads and reference ...
The reference-types proposal is now supported. It provides a new type, externref, which can hold any JavaScript value, for example strings, DOM ...
Read more >
WebAssembly Concepts - MDN Web Docs
WebAssembly is a new type of code that can be run in modern web ... of references (e.g. to functions) that could not...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found