Skip to content
This repository was archived by the owner on Aug 25, 2025. It is now read-only.
This repository was archived by the owner on Aug 25, 2025. It is now read-only.

webpack fails to parse WASM file generated by Rust 1.82+ #191

Description

@denis-sh

Describe the Bug

webpack v4 used in this template fails to parse WASM file generated by Rust 1.82+.

Steps to Reproduce

  1. rustup default 1.82.0
  2. npm run start
  3. See error:
ERROR in ./pkg/index_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

Expected Behavior

Template should work without errors with latest Rust compiler.

Actual Behavior

Template doesn't work with Rust 1.82+compiler.

Additional Context

Starting from Rust 1.82.0 (released 2024-10-17) Reference types are enabled for WebAssembly target by default, see rust-lang/rust#128475. Reason for this change was just upgrade to LLVM 19, see WebAssembly/tool-conventions#233.

This broke webpack, because it uses webassemblyjs to parse WASM files and the latter didn't have Reference types support, see webpack/webpack#15566 (opened 2022-03-20, long before Rust 1.82.0 release).

webassemblyjs v1.14.1 (released 2024-11-06, 3 weeks after Rust 1.82.0 release) added working support for Reference types.

webpack v5.97.0 (released 2024-12-03, 1.5 months after Rust 1.82.0 release) finally added support for WebAssembly Reference types.

Also see related wasm-bindgen issue wasm-bindgen/wasm-bindgen#4211 (opened 2024-10-18).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions