Skip to content
This repository was archived by the owner on Aug 25, 2025. It is now read-only.

Update template to webpack 5#175

Open
jtpio wants to merge 1 commit into
rustwasm:masterfrom
jtpio:webpack-5
Open

Update template to webpack 5#175
jtpio wants to merge 1 commit into
rustwasm:masterfrom
jtpio:webpack-5

Conversation

@jtpio

@jtpio jtpio commented Oct 17, 2020

Copy link
Copy Markdown

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

Thanks!

@olex-green

olex-green commented Oct 24, 2020

Copy link
Copy Markdown

I've tried to run with Webpack v5 with webpack-cli@4.1.0 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"

@Swaagie

Swaagie commented Nov 17, 2020

Copy link
Copy Markdown

It seems that the webpack-dev-server is not fully compatible yet webpack/webpack-dev-server#2807. I can confirm that experiments needs to be added to webpack config. Using webpack@5 without the dev server works fine btw

@JohnForster

Copy link
Copy Markdown

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?

@xtuc

xtuc commented Feb 5, 2021

Copy link
Copy Markdown
Member

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants