跳到内容
Tauri

Nuxt

Nuxt 是一个 Vue 元框架。访问 https://nuxtjs.org.cn 了解更多关于 Nuxt 的信息。本指南适用于 Nuxt 4.2 及更高版本。

  • 通过设置 ssr: false 使用静态站点生成(SSG)。Tauri 不支持基于服务器的解决方案。
  • tauri.conf.json 中使用默认的 ../dist 作为 frontendDist
  • 使用 nuxi build 进行编译。
  • (可选):通过在 nuxt.config.ts 中设置 telemetry: false 来禁用遥测功能。
  1. tauri.conf.json
    {
    "build": {
    "beforeDevCommand": "npm run dev",
    "beforeBuildCommand": "npm run generate",
    "devUrl": "https://:3000",
    "frontendDist": "../dist"
    }
    }
  2. export default defineNuxtConfig({
    compatibilityDate: '2025-05-15',
    // (optional) Enable the Nuxt devtools
    devtools: { enabled: true },
    // Enable SSG
    ssr: false,
    // Enables the development server to be discoverable by other devices when running on iOS physical devices
    devServer: {
    host: '0',
    },
    vite: {
    // Better support for Tauri CLI output
    clearScreen: false,
    // Enable environment variables
    // Additional environment variables can be found at
    // https://v2.tauri.org.cn/reference/environment-variables/
    envPrefix: ['VITE_', 'TAURI_'],
    server: {
    // Tauri requires a consistent port
    strictPort: true,
    },
    },
    // Avoids error [unhandledRejection] EMFILE: too many open files, watch
    ignore: ['**/src-tauri/**'],
    });

© 2026 Tauri 贡献者。CC-BY / MIT