Nuxt
Nuxt 是一个用于 Vue 的元框架。更多关于 Nuxt 的信息,请访问 https://nuxt.nodejs.cn。本指南截至 Nuxt 4.2 版本准确。
🌐 Nuxt is a meta framework for Vue. Learn more about Nuxt at https://nuxt.nodejs.cn. This guide is accurate as of Nuxt 4.2.
🌐 Checklist
- 通过设置
ssr: false使用 SSG。Tauri 不支持基于服务器的解决方案。 - 在
tauri.conf.json中将默认../dist用作frontendDist。 - 使用
nuxi build编译。 - (可选):通过在
nuxt.config.ts中设置telemetry: false来禁用遥测。
🌐 Example Configuration
-
tauri.conf.json {"build": {"beforeDevCommand": "npm run dev","beforeBuildCommand": "npm run generate","devUrl": "http://localhost:3000","frontendDist": "../dist"}}tauri.conf.json {"build": {"beforeDevCommand": "yarn dev","beforeBuildCommand": "yarn generate","devUrl": "http://localhost:3000","frontendDist": "../dist"}}tauri.conf.json {"build": {"beforeDevCommand": "pnpm dev","beforeBuildCommand": "pnpm generate","devUrl": "http://localhost:3000","frontendDist": "../dist"}}tauri.conf.json {"build": {"beforeDevCommand": "deno task dev","beforeBuildCommand": "deno task generate","devUrl": "http://localhost:3000","frontendDist": "../dist"}} -
export default defineNuxtConfig({compatibilityDate: '2025-05-15',// (optional) Enable the Nuxt devtoolsdevtools: { enabled: true },// Enable SSGssr: false,// Enables the development server to be discoverable by other devices when running on iOS physical devicesdevServer: {host: '0',},vite: {// Better support for Tauri CLI outputclearScreen: false,// Enable environment variables// Additional environment variables can be found at// https://v2.tauri.app/reference/environment-variables/envPrefix: ['VITE_', 'TAURI_'],server: {// Tauri requires a consistent portstrictPort: true,},},// Avoids error [unhandledRejection] EMFILE: too many open files, watchignore: ['**/src-tauri/**'],});
Tauri 中文网 - 粤ICP备13048890号
Nodejs.cn 旗下网站