Archive · OWD 3.x for Nuxt. This page describes the previous Nuxt integration. For OWD 4.x, see the current Nuxt guide.
Use this page when updating @owdproject/* themes, apps, or extension modules after @owdproject/core 3.3.2. It supersedes patterns from 3.3.0 (splitDesktopUserConfig, manual defu on public.desktop, appConfig.terminal, unknown-key warnings).
References in this monorepo: @owdproject/module-nuxt-fs (defineDesktopModule, types/desktop.d.ts), app-nuxt-terminal (same; apps live under /apps locally and may be gitignored).
Run these greps on the package you migrate:
# Legacy patterns to remove or replace
rg "defineNuxtModule" src/module.ts
rg "splitDesktopUserConfig|DESKTOP_RUNTIME_KEYS|unknown desktop key" .
rg "runtimeConfig\.public\.desktop\.\w+\s*=" src/module.ts
rg "defu\(.*desktop" src/module.ts
rg "appConfig\.(terminal|fs|desktop\.\w+)" .
rg "from '@owdproject/core'" src/module.ts # prefer subpath for defineDesktopModule
# After migration
rg "defineDesktopModule|defineDesktopTheme" src/module.ts
| Step | Action |
|---|---|
| 1 | Bump peerDependencies['@owdproject/core'] to ^3.3.2 (or workspace:* in monorepo). |
| 2 | module.ts: extension module or app with configKey → defineDesktopModule; theme → defineDesktopTheme. |
| 3 | Remove manual public.desktop[configKey] = … / defu in module.ts (handled by core). |
| 4 | Add types/desktop.d.ts with declare module 'nuxt/schema' { interface DesktopConfig { … } }. |
| 5 | Vue/runtime: read config from useRuntimeConfig().public.desktop.<key> or useDesktopExtension('key') (auto-import), not appConfig.<key>. |
| 6 | Keep runtime/plugin.ts → defineDesktopApp unchanged (apps only). |
| 7 | module.ts imports: defineDesktopModule from @owdproject/core/runtime/utils/defineDesktopModule (not main barrel). |
| 8 | Run pnpm exec nuxt-module-build build --stub in package, then nuxt prepare in playground/desktop. |
| Before (3.3.0) | After (3.3.2) |
|---|---|
splitDesktopUserConfig split install vs runtime keys | Full desktop.config → runtimeConfig.public.desktop (+ coreVersion) |
Warnings on fs, terminal, custom keys | Warnings only on Nuxt-like keys (ssr, vite, …) |
Each package hand-merged defu on public.desktop.fs | defineDesktopModule + installDesktopPackage pass desktop[configKey] into Nuxt |
Themes hand-defu(public.desktop, options) | Prefer defineDesktopTheme (same defu semantics) |
Some apps wrote appConfig.terminal | Single namespace: public.desktop.terminal |
defineDesktopApp is unchanged: it registers the program in the shell (windows, entries, commands). defineDesktopModule only wraps the Nuxt module layer.
@owdproject/module-*)When: package has meta.configKey (e.g. fs, persistence) and is listed under modules: in desktop.config.ts.
import { defineNuxtModule } from '@nuxt/kit'
import { defu } from 'defu'
export default defineNuxtModule({
meta: { name: 'owd-module-fs', configKey: 'fs' },
defaults: { mounts: { '/home': 'WebStorage' } },
async setup(options, nuxt) {
nuxt.options.runtimeConfig.public.desktop ??= {}
nuxt.options.runtimeConfig.public.desktop.fs = defu(
nuxt.options.runtimeConfig.public.desktop.fs ?? {},
options,
)
// …plugins, transpile, etc.
},
})
import { addPlugin, createResolver } from '@nuxt/kit'
import { defineDesktopModule } from '@owdproject/core/kit/authoring'
export default defineDesktopModule({
meta: { name: 'owd-module-fs', configKey: 'fs' },
defaults: { mounts: { '/home': 'WebStorage' } },
async setup(_options, nuxt) {
const { resolve } = createResolver(import.meta.url)
// merged config already on public.desktop.fs — do not assign again
addPlugin({ src: resolve('./runtime/plugin'), mode: 'client' })
},
})
types/desktop.d.tsdeclare module 'nuxt/schema' {
interface DesktopConfig {
fs?: {
mounts?: Record<string, string>
// …shape of your defaults + user overrides
}
}
}
export {}
Ensure package.json includes types/desktop.d.ts in files / TypeScript include.
// Preferred (auto-imported in apps that use @owdproject/core)
const fsConfig = useDesktopExtension('fs')
// Or explicit
const { public: { desktop } } = useRuntimeConfig()
Optional guards:
if (hasDesktopModule('@owdproject/module-nuxt-fs').value) { … }
@owdproject/app-*)Apps are two layers:
| Layer | API | File |
|---|---|---|
Nuxt module (components, Tailwind, optional configKey) | defineDesktopModule | src/module.ts |
| Desktop program registration | defineDesktopApp | src/runtime/plugin.ts |
configKey: 'terminal')Same migration as extension modules for module.ts. Do not remove defineDesktopApp from plugin.ts.
// src/runtime/plugin.ts — unchanged pattern
import { defineNuxtPlugin } from 'nuxt/app'
import { defineDesktopApp } from '@owdproject/core/runtime/utils/utilDesktop'
import config from './app.config'
export default defineNuxtPlugin({
name: 'owd-app-terminal-register',
async setup() {
if (import.meta.server) return
await defineDesktopApp(config)
},
})
configKeyIf the app only registers UI and has no desktop.config namespace, you may keep defineNuxtModule — no defineDesktopModule required. Most published apps with settings use a configKey.
<script setup lang="ts">
const runtimeConfig = useRuntimeConfig()
const terminal = computed(() => runtimeConfig.public.desktop.terminal)
</script>
<template>
<Terminal :prompt="terminal?.prompt" :welcomeMessage="terminal?.welcomeMessage" />
</template>
Do not read appConfig.terminal or appConfig.desktop.terminal for bootstrap config (legacy).
@owdproject/theme-*)When: package is theme: in desktop.config.ts; shell defaults (systemBar, workspaces, name, …).
import { defineNuxtModule } from '@nuxt/kit'
import { defu } from 'defu'
export default defineNuxtModule({
meta: { name: 'owd-theme-paper', configKey: 'desktop' },
defaults: { name: 'paper', systemBar: { enabled: true } },
async setup(options, nuxt) {
nuxt.options.runtimeConfig.public ??= {}
nuxt.options.runtimeConfig.public.desktop = defu(
nuxt.options.runtimeConfig.public.desktop ?? {},
options,
)
// addComponentsDir, registerTailwindPath, …
},
})
import { createResolver, addComponentsDir } from '@nuxt/kit'
import { defineDesktopTheme } from '@owdproject/core/kit/authoring'
import { registerTailwindPath } from '@owdproject/core'
export default defineDesktopTheme({
meta: { name: 'owd-theme-paper' },
defaults: { name: 'paper', systemBar: { enabled: true } },
async setup(_options, nuxt) {
const { resolve } = createResolver(import.meta.url)
addComponentsDir({ path: resolve('./runtime/components'), global: true })
registerTailwindPath(nuxt, resolve('./runtime/components/**/*.{vue,mjs,ts}'))
},
})
Semantics: user desktop.config.ts wins; theme defaults fill undefined only (same as before).
const hasFs = hasDesktopModule('@owdproject/module-nuxt-fs')
const fs = useDesktopExtension('fs')
Use in templates with .value on computed refs.
@owdproject/kit-theme, kit-fs, kit-explorer are plain Nuxt modules (no desktop.config namespace). No migration to defineDesktopTheme unless they start owning shell defaults.
desktop.config.ts (consumer project)No structural change required; extension keys are first-class:
import { defineDesktopConfig } from '@owdproject/core'
export default defineDesktopConfig({
theme: '@owdproject/theme-nuxt-nova',
modules: ['@owdproject/module-nuxt-fs'],
apps: ['@owdproject/app-nuxt-terminal'],
terminal: { prompt: 'my$ ' },
fs: { mounts: { '/home': 'WebStorage' } },
})
Import only defineDesktopConfig (and similar) from @owdproject/core main entry — not composables (see pitfalls).
| Symbol | Import from |
|---|---|
defineDesktopConfig, defineDesktopApp, registerTailwindPath | @owdproject/core |
defineDesktopModule | @owdproject/core/kit/authoring |
defineDesktopTheme | @owdproject/core/kit/authoring |
useDesktopConfig, useDesktopExtension, hasDesktop* | Auto-import in Nuxt apps with core (do not add to package module.ts barrel) |
Why: the main @owdproject/core entry must stay loadable from desktop.config.ts via jiti without Nuxt aliases (#imports).
| Symptom | Cause | Fix |
|---|---|---|
Cannot find module '#imports' during nuxt prepare / postinstall | Composables exported from @owdproject/core root and pulled in by desktop.config.ts | Import composables only via auto-import in Vue; keep them off index.ts |
Cannot load module / stub build fails for app | module.ts imports full @owdproject/core barrel | Use subpath for defineDesktopModule |
User desktop.config ignored for terminal | module.ts assigns public.desktop.terminal = options without merge | Use defineDesktopModule; remove manual assign |
hasDesktopModule always false | Wrong package string | Use exact npm name: '@owdproject/module-nuxt-fs' |
Types missing for desktop.fs | No augmentation file | Add types/desktop.d.ts in extension package |
# In the package directory
pnpm exec nuxt-module-build build --stub
# In playground or client/desktop
pnpm exec nuxt prepare
pnpm dev
fs, terminal, custom namespaces.runtimeConfig.public.desktop.modules / .apps populated when set in config.desktop validate passes.DESKTOP_KERNEL.md in @owdproject/core