|
há 2 anos atrás | |
---|---|---|
.. | ||
core | há 2 anos atrás | |
src | há 2 anos atrás | |
static | há 2 anos atrás | |
.gitignore | há 2 anos atrás | |
.npmrc | há 2 anos atrás | |
README.md | há 2 anos atrás | |
package.json | há 2 anos atrás | |
svelte.config.js | há 2 anos atrás | |
tsconfig.json | há 2 anos atrás | |
vite.config.ts | há 2 anos atrás | |
yarn.lock | há 2 anos atrás |
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