|
před 2 roky | |
---|---|---|
.. | ||
core | před 2 roky | |
src | před 2 roky | |
static | před 2 roky | |
.gitignore | před 2 roky | |
.npmrc | před 2 roky | |
README.md | před 2 roky | |
package.json | před 2 roky | |
svelte.config.js | před 2 roky | |
tsconfig.json | před 2 roky | |
vite.config.ts | před 2 roky | |
yarn.lock | před 2 roky |
This example showcases an application that has shares code between a desktop and a Web target.
The Web application uses WASM to communicate with the Rust backend, while the desktop app leverages Tauri commands.
The Rust code lives in the core/
folder and it is a Cargo workspace with three crates:
The Rust code bridge is defined in the src/api/
folder, which defines desktop/index.js
and a web/index.js
interfaces.
To access the proper interface according to the build target, a resolve alias is defined in vite.config.js, so the API can be imported
with import * as api from '$api'
.
Use the following commands to run the desktop application:
yarn
yarn tauri dev
Use the following commands to run the Web application:
yarn
yarn dev:web