|Jordan Gregory e2317dfb2e||1 year ago|
|public||1 year ago|
|src||1 year ago|
|.gitignore||1 year ago|
|README.md||1 year ago|
|package-lock.json||1 year ago|
|package.json||1 year ago|
|rollup.config.js||1 year ago|
This is a project template for Svelte apps that integrates Rust (WASM) as well.
To create a new project based on this template using cargo-generate:
cargo generate --git https://git.stlrust.org/j4ng5y/svelte-wasm-template --branch main --name <my app name> cd <my app name>
cargo install cargo-generate)
Install the dependencies...
cd <my app name> npm install
...then start Rollup:
npm run dev
Navigate to localhost:5000. You should see your app running. Edit a Svelte component file in
src, or the WASM component in
src/greeting/src, save it, restart the dev server to recompile the WASM, and then reload your page to see your changes.
By default, the server will only respond to requests from localhost. To allow connections from other computers, edit the
sirv commands in
package.json to include the option
If you’re using VSCode, we recommend installing the offical Svelte extension as well as the offical Rust extension. If you are using other editors, your may need to install a plugin in order to get syntax highlighting and intellisense for both Svelte and Rust.
To create an optimized version of the app:
npm run build
You can run the newly built app with
npm run start. This uses
sirv, which is invluded in your
package.json's dependencies so that the app will work with you deploy to platforms like Heroku.
sirv will only respond to requests that match files in
public. This is to maximize compatibility with static file servers, allowing you to deploy your app almost anywhere.
If you’re building a single-page application (SPA) with multiple routes,
sirv needs to be able to respond to requests for ANY path. You can make it so by editing the
start command in
"start": "sirv public --single"
I’ll write this section as soon as I deploy it 😄