facebook / create-react-app

Set up a modern web app by running one command.
https://create-react-app.dev
MIT License
102.73k stars 26.85k forks source link

magic header not detected when build .wasm file #10639

Open unicornonea opened 3 years ago

unicornonea commented 3 years ago

Hi, I use .wasm file in create-react-app, but when I run 'npm run build', I got the error:

**Module parse failed: magic header not detected File was processed with these loaders:

I already add 'wasm-loader' in the project according to this article: https://www.telerik.com/blogs/using-webassembly-with-react However when I import the same .wasm file in vue-cli, it can work correctly.

Could the create-react-app support .wasm or change the default webpack config to support this? Thanks!

delta1 commented 2 years ago

The default webpack config needs to remove wasm types from being loaded with file-loader

https://dev.to/lokesh007/webassembly-with-rust-and-react-using-create-react-app-67

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had any recent activity. It will be closed in 5 days if no further activity occurs.

delta1 commented 2 years ago

You’re stale, bot.