[WASM] Create a New Rust/Webpack Project using the rust-webpack Template

Previous to this post, we set up our own Rust/wasm project from scratch.

The Rust/wasm team ships a template for you to get started right away. In this lesson, you'll see how to initialize the template (assumes you have wasm-pack installed) and see how this template gives you additional custom Rust features in addition to the WasmPackPlugin that will build your library on every file change.

We are going to use the library: create-rust-webpack

Run:

cd my-app
npm init rust-webpack
npm install

Be aware that this template relies on you having wasm-pack installed. In case you haven't done this, just run.

 cargo install wasm-pack

Run:

npm start
原文地址:https://www.cnblogs.com/Answer1215/p/9838046.html