I'm trying to write hello, world with rust and wasm. Dev server works with
"webpack": "^4.29.3",
"webpack-dev-server": "^3.1.5"
but if update to
"webpack": "^5.90.3",
"webpack-dev-server": "^5.0.2"
Module not found error occurs after rebuilding wasm.
Steps to reproduce:
git clone https://github.com/levap5/wasm-game-of-life.gitcd wasm-game-of-lifegit checkout 90666d3fwasm-pack buildcd wwwnpm installnpm run start| webpack-dev-server will start. There are no errors now.- open http://localhost:8080/ It works as expected
- change alert message in
src/lib.rs wasm-pack buildinwasm-game-of-lifedir
The error occurs after step 10 and http://localhost:8080/ runs old (cached) rust (wasm) code. How to fix this?
I found a solution using wasm-pack-plugin plugin.
package.json:
webpack.config.js:
However, the plugin's maintenance is questionable. I immediately came across this issue. After looking at the plugin code, the issue seems easy to fix.