rust-webpack-template icon indicating copy to clipboard operation
rust-webpack-template copied to clipboard

Update template to webpack 5

Open jtpio opened this issue 4 years ago • 4 comments

Trying out the template with the recent webpack 5, it looks like the following change to the config is required to enable WebAssembly.

Thanks!

jtpio avatar Oct 17 '20 10:10 jtpio

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"

olex-green avatar Oct 24 '20 06:10 olex-green

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

Swaagie avatar Nov 17 '20 15:11 Swaagie

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 avatar Jan 18 '21 14:01 JohnForster

@JohnForster this is likely an issue in the code that wasm-bindgen generates.

xtuc avatar Feb 05 '21 17:02 xtuc