Skip to content

Latest commit

 

History

History
96 lines (83 loc) · 1.87 KB

nuxt.mdx

File metadata and controls

96 lines (83 loc) · 1.87 KB
title
Nuxt

import { Tabs, TabItem } from '@astrojs/starlight/components';

Learn more about Nuxt at https://nuxt.com. This guide is accurate as of Nuxt 3.7.

Checklist

  • Use SSG by setting ssr: false. Tauri doesn't support server based solutions.
  • Set host to 0.0.0.0.
  • Use dist/ as distDir in tauri.conf.json.
  • Compile using nuxi generate.
  • (Optional): Disable telemetry by setting telemetry: false in nuxt.config.ts.

Example Configuration

// tauri.conf.json
{
	"build": {
		"beforeDevCommand": "npm run dev",
		"beforeBuildCommand": "npm run generate",
		"devPath": "http://localhost:3000",
		"distDir": "../dist"
	}
}
</TabItem>
<TabItem label="yarn">
// tauri.conf.json
{
	"build": {
		"beforeDevCommand": "yarn dev",
		"beforeBuildCommand": "yarn generate",
		"devPath": "http://localhost:3000",
		"distDir": "../dist"
	}
}
</TabItem>
<TabItem label="pnpm">
// tauri.conf.json
{
	"build": {
		"beforeDevCommand": "pnpm dev",
		"beforeBuildCommand": "pnpm generate",
		"devPath": "http://localhost:3000",
		"distDir": "../dist"
	}
}
</TabItem>
export default defineNuxtConfig({
	// (optional) Enable the Nuxt devtools
	devtools: { enabled: true },
	// Enable SSG
	ssr: false,
	// (optional) Disable telemetry
	telemetry: false,
	vite: {
		// Better support for Tauri CLI output
		clearScreen: false,
		// Enable environment variables
		envPrefix: ['VITE_', 'TAURI_'],
		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,
			},
		},
	},
});