@next react-scripts(webpack.config.js) to resolve `.wasm` extension?
See original GitHub issueI was curious if there was any reason .wasm
extension was left out from resolve.extensions
list?
Webpack also default to include .wasm
.
It’d be nice to start using/experimenting wasm from create-react-app!
Issue Analytics
- State:
- Created 5 years ago
- Reactions:32
- Comments:17 (7 by maintainers)
Top Results From Across the Web
Customize webpack configuration of React App created with ...
It was Saturday night hanging around to solve the issue of “ReferenceError: legacyLib is not defined” in my React+Typescript app.
Read more >Using WebAssembly with React - Telerik
Modify Webpack to Support WebAssembly. We need to add a config-overrides.js file to the root of our app. This file will allow us...
Read more >An Introduction to WebAssembly - Part 2 - Section.io
This article includes WebAssembly walk through the steps of building a react application the consumes a Wasm module.
Read more >How to use WebAssembly (wasm) with create-react-app
The following solution is for CRA 3.x. For CRA 4.x you should use craco. CRA does not support WASM. But you can workaround...
Read more >WASM in Create-React-App 4 in 5mn (without ejecting)
Run WASM code in your create-react-app without pain (and without ejecting). ... /\.wasm$/; webpackConfig.resolve.extensions.push('.wasm'); ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
From what I have seen in other discussions, it seems like the create-react-app philosophy is to ignore the fact that it uses webpack internally - in other words, webpack features should not be relied upon. However, webpack includes a match for
.wasm
indefaultRules
which does not magically work for all.wasm
files.For example, when using a
.wasm
file created with Emscripten (https://github.com/webpack/webpack/issues/7352) in a create-react-app project, we get the error:So it would be nice if create-create-react app could disable this default rule in webpack so users can handle
.wasm
files however they like without webpack interfering.As a workaround, I changed the file extension of the
.wasm
file to.emcwasm
so that webpack just treated it like a normal binary file instead of trying to load it as a JavaScript module. (And had to configure the web server to serve.emcwasm
files with theapplication/wasm
MIME type.)Is there no way of making it work by overriding config in config-overrides?