Skip to content

Commit 2cf27e6

Browse files
committed
feat: add tauri examples
1 parent cbf9ecf commit 2cf27e6

78 files changed

Lines changed: 11447 additions & 0 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
*.local
2+
.env
3+
.nitro
4+
.tanstack
5+
.wrangler
6+
.output
7+
.vinxi
8+
__unconfig*
9+
todos.json
10+
11+
.DS_Store
12+
13+
.vscode
14+
.idea
15+
16+
# dependencies
17+
/node_modules
18+
/.pnp
19+
.pnp.*
20+
.yarn/*
21+
!.yarn/patches
22+
!.yarn/plugins
23+
!.yarn/releases
24+
!.yarn/versions
25+
26+
# testing
27+
/coverage
28+
29+
# production
30+
/build
31+
/dist
32+
/dist-ssr
33+
src-tauri/gen
34+
src-tauri/target
35+
36+
/private
37+
/public/uploads
38+
39+
# misc
40+
*.pem
41+
42+
# debug
43+
*.log*
44+
45+
# env files (can opt-in for committing if needed)
46+
.env*
47+
48+
# vercel
49+
.vercel
50+
51+
# typescript
52+
*.tsbuildinfo
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# TanStack Router - Rspack File-Based-Tauri Quickstart
2+
3+
A quickstart example using Rspack as the bundler with file-based-tauri routing.
4+
5+
- [TanStack Router Docs](https://tanstack.com/router)
6+
- [Rspack Documentation](https://www.rspack.dev/)
7+
8+
## Start a new project based on this example
9+
10+
To start a new project based on this example, run:
11+
12+
```sh
13+
npx gitpick TanStack/router/tree/main/examples/react/quickstart-rspack-file-based-tauri quickstart-rspack-file-based-tauri
14+
```
15+
16+
## Getting Started
17+
18+
Install dependencies:
19+
20+
```sh
21+
pnpm install
22+
```
23+
24+
Start the development server:
25+
26+
```sh
27+
pnpm dev
28+
```
29+
30+
## Build
31+
32+
Build for production:
33+
34+
```sh
35+
pnpm build
36+
```
37+
38+
## About This Example
39+
40+
This example demonstrates:
41+
42+
- Rspack bundler integration
43+
- file-based-tauri routing
44+
- Fast build times with Rust-based tooling
45+
- Webpack-compatible configuration
46+
47+
48+
**Note** If you want to build a Tauri application, you might encounter some issues with route requests. For example, after accessing a route, there might actually be a request address like `http://tauri.localhost/lazy-compilation-using-`. In this case, you need to set [`lazyCompilation`](https://rsbuild.rs/config/dev/lazy-compilation#introduction) to `false`.
49+
50+
```ts
51+
// rsbuild.config.ts
52+
export default defineConfig({
53+
plugins: [pluginReact()],
54+
dev: {
55+
lazyCompilation: false,
56+
},
57+
})
58+
```
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"name": "tanstack-router-react-example-quickstart-rspack-file-based-tauri",
3+
"private": true,
4+
"type": "module",
5+
"scripts": {
6+
"dev": "rsbuild dev --port 3000",
7+
"build": "rsbuild build && tsc --noEmit",
8+
"preview": "rsbuild preview",
9+
"tauri": "tauri"
10+
},
11+
"dependencies": {
12+
"@tanstack/react-router": "^1.168.23",
13+
"react": "^19.2.3",
14+
"react-dom": "^19.2.3"
15+
},
16+
"devDependencies": {
17+
"@rsbuild/core": "^1.2.4",
18+
"@rsbuild/plugin-react": "^1.1.0",
19+
"@tailwindcss/postcss": "^4.1.18",
20+
"@tanstack/router-plugin": "^1.167.22",
21+
"@tauri-apps/cli": "^2.10.1",
22+
"@types/react": "^19.2.7",
23+
"@types/react-dom": "^19.2.3",
24+
"tailwindcss": "^4.1.18",
25+
"typescript": "^5.9.3"
26+
}
27+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
export default {
2+
plugins: {
3+
'@tailwindcss/postcss': {},
4+
},
5+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import { defineConfig } from '@rsbuild/core'
2+
import { pluginReact } from '@rsbuild/plugin-react'
3+
import { tanstackRouter } from '@tanstack/router-plugin/rspack'
4+
5+
export default defineConfig({
6+
plugins: [pluginReact()],
7+
tools: {
8+
rspack: {
9+
plugins: [tanstackRouter({ target: 'react', autoCodeSplitting: true })],
10+
},
11+
},
12+
dev: {
13+
lazyCompilation: false,
14+
},
15+
})
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Generated by Cargo
2+
# will have compiled files and executables
3+
/target/
4+
/gen/schemas

0 commit comments

Comments
 (0)