This guide helps you upgrade from @flyo/nitro-nuxt v1 to v2.
- Module now requires Nuxt 4.3.1+ (upgraded from Nuxt 3)
- @nuxt/kit updated to v4.3.1
- All module composition APIs are Nuxt 4 compatible
Migration: Update your nuxt.config.ts to use Nuxt 4:
npm install nuxt@^4.3.1 @nuxt/kit@^4.3.1@flyo/nitro-vue3dependency upgraded from ^1.0.2 to ^2.0.0- Plugin initialization remains the same via
vueApp.use(FlyoVue, { ... }) - All composables maintain backward compatibility:
useFlyoConfig()useFlyoPage(slug)useFlyoEntity(uniqueId)useFlyoCurrentPage()useFlyoSitemap()
No action required for composable usage if using v1.
- Module builds now output
.mjsonly (no CommonJS.cjs) - TypeScript definitions are
.d.mtsformat - Build size optimized: 6.36 kB total
Migration: If you import from dist directly, ensure your bundler supports ES modules:
{
"type": "module",
"exports": {
".": {
"import": "./dist/module.mjs",
"types": "./dist/module.d.mts"
}
}
}dist/is now in.gitignore- Module is built during GitHub Actions release workflow
- CI automatically generates and publishes dist files
Impact: Releases are now reproducible and tamper-proof. No need to manage dist manually.
npm install @flyo/nitro-nuxt@^2.0.0Ensure your nuxt.config.ts uses valid module options:
export default defineNuxtConfig({
modules: [
['@flyo/nitro-nuxt', {
apiToken: process.env.FLYO_API_TOKEN,
apiBasePath: process.env.FLYO_API_BASE_PATH,
liveEdit: true,
liveEditOrigin: 'https://flyo.cloud',
registerPageRoutes: true,
defaultPageRoute: 'cms'
}]
]
})If registerPageRoutes: true (default), create the dynamic route handler:
pages/cms.vue:
<script setup lang="ts">
const { response: page } = await useFlyoCurrentPage()
</script>
<template>
<div>
<h1>{{ page?.title }}</h1>
<!-- Your CMS content here -->
</div>
</template>No changes from v1. Continue using:
FLYO_API_TOKEN=your-token
FLYO_API_BASE_PATH=https://api.flyo.test
FLYO_LIVE_EDIT=true
FLYO_LIVE_EDIT_ORIGIN=https://flyo.cloudVerify everything works:
npm run test # Run unit tests (11 tests)
npm run build # Build module
npm run playground:build # Verify playground integration- ✅ Plugin initialization unchanged
- ✅ Composable signatures unchanged
- ✅ Runtime config keys unchanged
- ✅ Environment variable names unchanged
- BREAKING: Module is now ESM-only (no CommonJS)
- BREAKING: Nuxt 3 is no longer supported (Nuxt 4+ required)
- BREAKING: dist folder no longer in git (built by CI)
If you're using this module as a dependency:
- Ensure your app uses Nuxt 4.3.1+
- Your bundler must support ES modules
- Composables work the same; no code changes needed
Ensure your .env file has:
FLYO_API_TOKEN=your-actual-tokenCreate the required page file:
touch pages/cms.vueRun the build first:
npm run buildFor issues with:
- This Nuxt module: Check GitHub repo
- @flyo/nitro-vue3: See @flyo/nitro-vue3 docs
- Nuxt 4: Visit Nuxt docs