withInertiaStatic()
Add the client to createInertiaApp. The same code works on Inertia 2 and 3.
ts
import { createInertiaApp } from '@inertiajs/vue3'
import { withInertiaStatic } from '@fydellys/inertia-static/vue'
import manifest from './inertia-static.json'
createInertiaApp({
...withInertiaStatic({ manifest }),
// resolve, setup, ...
})tsx
import { createInertiaApp } from '@inertiajs/react'
import { withInertiaStatic } from '@fydellys/inertia-static/react'
import manifest from './inertia-static.json'
createInertiaApp({
...withInertiaStatic({ manifest }),
// resolve, setup, ...
})Reference
ts
withInertiaStatic(options?: InertiaStaticOptions): object // spread into createInertiaApp()The options are those of the client.
Good to know
- It needs the Vite plugin: the plugin detects the Inertia version installed and resolves
@fydellys/inertia-static/vueand/reactto the matching client. Force it withinertiaStatic({ inertia: 2 }). - On Inertia 3 it sets the
httpoption (inertiaStatic()). On Inertia 2 it installs the client on the app'saxios(installInertiaStatic()) and sets no option. client(a custom HTTP client) only applies to Inertia 3.