[!IMPORTANT]
This implementation is now built-in to Nuxt 3+ and this module is no longer required.
Full static implementation for Nuxt 3
undefined⚠️ nuxt-full-static is a proof of concept. ⚠️undefined
👉 Roadmap and progress for nuxt 3 payload extraction support: nuxt/framework#6411
import { defineNuxtConfig } from 'nuxt'
export default defineNuxtConfig({
modules: ['nuxt-full-static'],
})
Automatically, all your useAsyncData and useFetch calls will be prefilled with static payloads. As long as you haven’t set initialCache or server to false, you should not see these functions running on client-side at all. You can even stub them out by prefixing them with process.server &&:
const { data } = useAsyncData(() => process.server && $fetch('https://my.api.com/data'))
However, you also retain the ability to opt-out, by manually calling refresh. This will result in running the data fetching function again.
corepack enablepnpm installpnpm dev:preparepnpm dev to start playground in development modeMade with ❤️
Published under the MIT License.
We use cookies
We use cookies to analyze traffic and improve your experience. You can accept or reject analytics cookies.