I attempted to follow along with the MDN guide for compiling simple Rust to wasm. Each step worked without error until I attempted to run the web pack server, at which point the below error was thrown:
ERROR in ./node_modules/@andereid/hello-wasm/hello_wasm_bg.wasm
Module parse failed: Unexpected section: 0xfe
You may need an appropriate loader to handle this file type.
Error: Unexpected section: 0xfe
at new CompileError (.........
@ ./node_modules/@andereid/hello-wasm/hello_wasm.js 2:0-40 8:71-82 9:45-56 30:16-38 43:15-25 46:8-28
@ ./index.js
@ multi (webpack)-dev-server/client?http://localhost:8080 ./index.js
ERROR in chunk 0
3e2522591534271b41d1.module.wasm
C:\.....\node_modules\@andereid\hello-wasm\hello_wasm_bg.wasm
unexpected end
I went out to npm and just tried pulling in an npm package from someone else that had been published from the tutorial, and that did work. However going to that repo, cloning it locally, running wasm-pack build --scope mynpmusername, pushing it up to npm, and then pulling it to run through webpack resulted in the same error above. That leads me to believe that it has to be something with how I'm compiling the Rust to WebAssembly, but I don't have the skills to troubleshoot. Let me know if there's anything further I can provide.
Hello,
I attempted to follow along with the MDN guide for compiling simple Rust to wasm. Each step worked without error until I attempted to run the web pack server, at which point the below error was thrown:
I went out to npm and just tried pulling in an npm package from someone else that had been published from the tutorial, and that did work. However going to that repo, cloning it locally, running
wasm-pack build --scope mynpmusername
, pushing it up to npm, and then pulling it to run through webpack resulted in the same error above. That leads me to believe that it has to be something with how I'm compiling the Rust to WebAssembly, but I don't have the skills to troubleshoot. Let me know if there's anything further I can provide.OS: Windows 10 wasm-pack 0.6.0 rustc 1.32.0 (9fda7c223 2019-01-16) cargo 1.32.0 (8610973aa 2019-01-02)