Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FOR ANYONE WHO IS GOING THROUGH THE STEPS IN 'Hello, World' AND HAS ERRORS #309

Open
magnus-ISU opened this issue Feb 21, 2024 · 2 comments

Comments

@magnus-ISU
Copy link

Run the following code instead:

cargo generate --git https://github.com/rustwasm/wasm-pack-template # Type wasm-game-of-life

and then

cd wasm-game-of-life
wasm-pack build
npm init wasm-app www
# Fix dependencies. We will first install sd to make replacing text easier and cross-platform and rusty.
cargo install sd
sd '  "devDependencies": \{
    "hello-wasm-pack": "\^0.1.0",
    "webpack": "\^4.29.3",
    "webpack-cli": "\^3.1.0",
    "webpack-dev-server": "\^3.1.5",
    "copy-webpack-plugin": "\^5.0.0"
  \}' ' "dependencies": {
    "wasm-game-of-life": "file:../pkg"
  },
  "devDependencies": {
    "copy-webpack-plugin": "^11.0.0",
    "hello-wasm-pack": "^0.1.0",
    "webpack": "^5.90.0",
    "webpack-cli": "^5.1.4",
    "webpack-dev-server": "^4.15.1"
  }' www/package.json
cd www
rm package-lock.json
npm install
# Fix webpack config
sd -F "new CopyWebpackPlugin(['index.html'])" 'new CopyWebpackPlugin({ patterns: ["index.html"] })' webpack.config.js
sd '^\}' '  experiments: { asyncWebAssembly: true },\n}' webpack.config.js
npm run start

This should work in bash. In zsh you can just run it all at once for some reason

@hunterchen7
Copy link

Thanks for this, was really helpful.

I was still having issues with this but I changed the devDependencies in package.json to this:

  "devDependencies": {
    "copy-webpack-plugin": "^11.0.0",
    "hello-wasm-pack": "^0.1.0",
    "webpack": "^5.88.1",
    "webpack-cli": "^5.1.4",
    "webpack-dev-server": "^4.15.1"
  }

and that fixed it.

@richardpringle
Copy link

@magnus-ISU, did you PR the wasm-pack-template?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants