Setup
This should get you up and running with a basic Nuxt based project quick and easy.
# Create a projectnpx nuxi init \ && cd nuxt-app \ && pnpm add @tauri-apps/cli \ && pnpm tauri init
{ "build": { "beforeDevCommand": "pnpm dev", "beforeBuildCommand": "pnpm generate", "devPath": "http://localhost:3000", "distDir": "../dist" }}
There’s a security advisory up for using envPrefix
. If you manage your secrets correctly and only build in release mode wherever secrets are located then you can keep using it, but the recommended approach to avoid leaking secrets is to define them individually. Note that
// https://nuxt.com/docs/api/configuration/nuxt-configexport default defineNuxtConfig({ devtools: { enabled: true }, ssr: false, vite: { // Better support for Tauri CLI output clearScreen: false, // https://github.com/tauri-apps/tauri/security/advisories/GHSA-2rcp-jvr4-r259 define: { TAURI_PLATFORM: JSON.stringify(process.env.TAURI_PLATFORM), TAURI_ARCH: JSON.stringify(process.env.TAURI_ARCH), TAURI_FAMILY: JSON.stringify(process.env.TAURI_FAMILY), TAURI_PLATFORM_VERSION: JSON.stringify(process.env.TAURI_PLATFORM_VERSION), TAURI_PLATFORM_TYPE: JSON.stringify(process.env.TAURI_PLATFORM_TYPE), TAURI_DEBUG: JSON.stringify(process.env.TAURI_DEBUG), }, // Dev server configurations server: { // Tauri requires a consistent port strictPort: true, // Enables the development server to be discoverable by other devices for mobile development host: '0.0.0.0', hmr: { // Use websocket for mobile hot reloading protocol: 'ws', // Make sure it's available on the network host: '0.0.0.0', // Use a specific port for hmr port: 5183, }, }, },});