rust-webpack-template
rust-webpack-template copied to clipboard
Update template to webpack 5
Trying out the template with the recent webpack 5, it looks like the following change to the config is required to enable WebAssembly.
Thanks!
I've tried to run with Webpack v5 with [email protected] and I got error: Error: Cannot find module 'webpack-cli/bin/config-yargs'
The solution: changing npm start script from:
"start": "rimraf dist pkg && webpack-dev-server --open -d",
to:
"start": "rimraf dist pkg && webpack serve"
It seems that the webpack-dev-server is not fully compatible yet https://github.com/webpack/webpack-dev-server/issues/2807. I can confirm that experiments
needs to be added to webpack config. Using webpack@5 without the dev server works fine btw
Using webpack@5 without the dev server works fine btw
@Swaagie I can't seem to get this working, I get the error: "ReferenceError: Cannot access '__wbindgen_string_new' before initialization" unless I use experiments: { syncWebAssembly: true }
in my webpack.config.js. Synchronous loading of wasm modules is deprecated since webpack v4.
Is there a way to configure wasm-pack so that we can use asyncWebAssembly instead?
@JohnForster this is likely an issue in the code that wasm-bindgen generates.