/** @type {import('next').NextConfig} */ const nextConfig = { // Ensure Next.js uses SSG instead of SSR // https://nextjs.net.cn/docs/pages/building-your-application/deploying/static-exports output: 'export', // Note: This feature is required to use the Next.js Image component in SSG mode. // See https://nextjs.net.cn/docs/messages/export-image-api for different workarounds. images: { unoptimized: true, }, // Configure assetPrefix or else the server won't properly resolve your assets. assetPrefix: isProd ? undefined : `http://${internalHost}:3000`, };
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/**'], });
Qwik
Qwik Web 框架是一个为构建高性能的 Web 应用程序而设计的前端 JavaScript框架。
清单
使用 SSG。Tauri 不支持基于服务器的解决方案。
tauri.conf.json 中使用 dist/ 作为 frontendDist。
示例配置
创建新的 Qwik 应用
1 2 3
npm || yarn || pnpm create qwik@latest (deno)deno run -A npm:create-qwik@latest cd <PROJECT>
export default defineConfig({ // prevent vite from obscuring rust errors clearScreen: false, server: { // make sure this port matches the devUrl port in tauri.conf.json file port: 5173, // Tauri expects a fixed port, fail if that port is not available strictPort: true, // if the host Tauri is expecting is set, use it host: host || false, hmr: host ? { protocol: 'ws', host, port: 1421, } : undefined,
watch: { // tell vite to ignore watching `src-tauri` ignored: ['**/src-tauri/**'], }, }, // Env variables starting with the item of `envPrefix` will be exposed in tauri's source code through `import.meta.env`. envPrefix: ['VITE_', 'TAURI_ENV_*'], build: { // Tauri uses Chromium on Windows and WebKit on macOS and Linux target: process.env.TAURI_ENV_PLATFORM == 'windows' ? 'chrome105' : 'safari13', // don't minify for debug builds minify: !process.env.TAURI_ENV_DEBUG ? 'esbuild' : false, // produce sourcemaps for debug builds sourcemap: !!process.env.TAURI_ENV_DEBUG, }, });