Open chrisdsloan opened 1 year ago
I managed to start the tutorial by installing the latest versions of all packages in www/package.json
because npm audit
broke it beyond repair for me . The devDependencies
look like this now:
"devDependencies": {
"copy-webpack-plugin": "^11.0.0",
"hello-wasm-pack": "^0.1.0",
"webpack": "^5.88.0",
"webpack-cli": "^5.1.4",
"webpack-dev-server": "^4.15.1"
}
Then I had another warning prompting me to enable webassembly, so I went to edit the www/webpack.config.js
file with this extra key:
module.exports = {
// rest of the config ommited
experiments: { asyncWebAssembly: true },
};
npm start
works fine now.
I managed to start the tutorial by installing the latest versions of all packages
Thanks @jcespinoza . I want to add that I had to do the additional step of updating the argument to CopyWebPackPlugin
in the webpack config
from:
plugins: [new CopyWebpackPlugin(["index.html"])],
to:
plugins: [new CopyWebpackPlugin({ patterns: ["index.html"] })],
My resulting dependencies in package.json
were nearly identical to the above:
"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"
}
So it seems that the necessary code to get started is: (this works in zsh for sure)
cargo generate --git https://github.com/rustwasm/wasm-pack-template # Type wasm-game-of-life
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
I'm following the tutorial at https://rustwasm.github.io/docs/book/game-of-life/hello-world.html and get as far as the
npm run start
command where I get errors. The only divergence from the instructions were:After the
wasm-pack build
command, I got the following warnings:So, I run
npm audit
as requested:That fixes the vulnerability warning, but the
npm run start
command fails with error:So, obviously, if I had not attempted to fix the vulnerabilities, it might have "worked" but I'm far enough beyond my depth to not know how to evaluate that risk.
My environment is Pop!_OS 20.04 LTS (an Ubuntu variant).
npm --version
returns "6.14.4." I'm not sure what other context would be helpful.The debug log mentioned in the error message above is attached: debug.log