-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
feat: add tauri examples #7224
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
feat: add tauri examples #7224
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| *.local | ||
| .env | ||
| .nitro | ||
| .tanstack | ||
| .wrangler | ||
| .output | ||
| .vinxi | ||
| __unconfig* | ||
| todos.json | ||
|
|
||
| .DS_Store | ||
|
|
||
| .vscode | ||
| .idea | ||
|
|
||
| # dependencies | ||
| /node_modules | ||
| /.pnp | ||
| .pnp.* | ||
| .yarn/* | ||
| !.yarn/patches | ||
| !.yarn/plugins | ||
| !.yarn/releases | ||
| !.yarn/versions | ||
|
|
||
| # testing | ||
| /coverage | ||
|
|
||
| # production | ||
| /build | ||
| /dist | ||
| /dist-ssr | ||
| src-tauri/gen | ||
| src-tauri/target | ||
|
|
||
| /private | ||
| /public/uploads | ||
|
|
||
| # misc | ||
| *.pem | ||
|
|
||
| # debug | ||
| *.log* | ||
|
|
||
| # env files (can opt-in for committing if needed) | ||
| .env* | ||
|
|
||
| # vercel | ||
| .vercel | ||
|
|
||
| # typescript | ||
| *.tsbuildinfo |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| # TanStack Router - Rspack File-Based-Tauri Quickstart | ||
|
|
||
| A quickstart example using Rspack as the bundler with file-based-tauri routing. | ||
|
|
||
| - [TanStack Router Docs](https://tanstack.com/router) | ||
| - [Rspack Documentation](https://www.rspack.dev/) | ||
|
|
||
| ## Start a new project based on this example | ||
|
|
||
| To start a new project based on this example, run: | ||
|
|
||
| ```sh | ||
| npx gitpick TanStack/router/tree/main/examples/react/quickstart-rspack-file-based-tauri quickstart-rspack-file-based-tauri | ||
| ``` | ||
|
|
||
| ## Getting Started | ||
|
|
||
| Install dependencies: | ||
|
|
||
| ```sh | ||
| pnpm install | ||
| ``` | ||
|
|
||
| Start the development server: | ||
|
|
||
| ```sh | ||
| pnpm dev | ||
| ``` | ||
|
|
||
| ## Build | ||
|
|
||
| Build for production: | ||
|
|
||
| ```sh | ||
| pnpm build | ||
| ``` | ||
|
|
||
| ## About This Example | ||
|
|
||
| This example demonstrates: | ||
|
|
||
| - Rspack bundler integration | ||
| - file-based-tauri routing | ||
| - Fast build times with Rust-based tooling | ||
| - Webpack-compatible configuration | ||
|
|
||
|
|
||
| **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`. | ||
|
|
||
| ```ts | ||
| // rsbuild.config.ts | ||
| export default defineConfig({ | ||
| plugins: [pluginReact()], | ||
| dev: { | ||
| lazyCompilation: false, | ||
| }, | ||
| }) | ||
| ``` | ||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,27 @@ | ||||||
| { | ||||||
| "name": "tanstack-router-react-example-quickstart-rspack-file-based-tauri", | ||||||
| "private": true, | ||||||
| "type": "module", | ||||||
| "scripts": { | ||||||
| "dev": "rsbuild dev --port 3000", | ||||||
| "build": "rsbuild build && tsc --noEmit", | ||||||
| "preview": "rsbuild preview", | ||||||
| "tauri": "tauri" | ||||||
| }, | ||||||
| "dependencies": { | ||||||
| "@tanstack/react-router": "^1.168.23", | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion | 🟠 Major Use the workspace protocol for the internal This example lives inside the monorepo and should consume the local package via the workspace protocol so it always builds against the current source rather than the last published range. ♻️ Proposed fix- "@tanstack/react-router": "^1.168.23",
+ "@tanstack/react-router": "workspace:^",The same applies to Based on learnings: "Applies to package.json : Use workspace protocol for internal dependencies (workspace:*)". 📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||
| "react": "^19.2.3", | ||||||
| "react-dom": "^19.2.3" | ||||||
| }, | ||||||
| "devDependencies": { | ||||||
| "@rsbuild/core": "^1.2.4", | ||||||
| "@rsbuild/plugin-react": "^1.1.0", | ||||||
| "@tailwindcss/postcss": "^4.1.18", | ||||||
| "@tanstack/router-plugin": "^1.167.22", | ||||||
| "@tauri-apps/cli": "^2.10.1", | ||||||
| "@types/react": "^19.2.7", | ||||||
| "@types/react-dom": "^19.2.3", | ||||||
| "tailwindcss": "^4.1.18", | ||||||
| "typescript": "^5.9.3" | ||||||
| } | ||||||
| } | ||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| export default { | ||
| plugins: { | ||
| '@tailwindcss/postcss': {}, | ||
| }, | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| import { defineConfig } from '@rsbuild/core' | ||
| import { pluginReact } from '@rsbuild/plugin-react' | ||
| import { tanstackRouter } from '@tanstack/router-plugin/rspack' | ||
|
|
||
| export default defineConfig({ | ||
| plugins: [pluginReact()], | ||
| tools: { | ||
| rspack: { | ||
| plugins: [tanstackRouter({ target: 'react', autoCodeSplitting: true })], | ||
| }, | ||
| }, | ||
| dev: { | ||
| lazyCompilation: false, | ||
| }, | ||
| }) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| # Generated by Cargo | ||
| # will have compiled files and executables | ||
| /target/ | ||
| /gen/schemas |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Clarify the Tauri routing note and make the config snippet copy-pasteable.
The example URL in the note appears truncated/confusing, and the snippet omits imports for
defineConfig/pluginReact.✏️ Suggested README tweak
Verify each finding against the current code and only fix it if needed.
In
@examples/react/quickstart-rspack-file-based-tauri/README.mdaround lines 48non-truncated form (e.g., use
"http://tauri.localhost/lazy-compilation-using-react" or similar) and make the
rsbuild.config.ts snippet copy-pasteable by adding the missing imports for
defineConfig and pluginReact (reference the config block using defineConfig({
plugins: [pluginReact()], dev: { lazyCompilation: false } }) and ensure imports
for defineConfig and pluginReact appear above it).