fix(nuxt): add backwards-compatible serialisation for nuxt.options.pages

This commit is contained in:
Daniel Roe 2025-03-02 08:32:27 +00:00
parent 66f3d93853
commit fa480e0a0a
No known key found for this signature in database
GPG Key ID: CBC814C393D93268

View File

@ -97,6 +97,12 @@ export default defineNuxtModule({
}
options.enabled = await isPagesEnabled()
nuxt.options.pages = options
// For backwards compatibility with `@nuxtjs/i18n` and other modules that serialize `nuxt.options.pages` directly
// TODO: remove in a future major
Object.defineProperty(nuxt.options.pages, 'toString', {
enumerable: false,
get: () => () => options.enabled,
})
if (nuxt.options.dev && options.enabled) {
// Add plugin to check if pages are enabled without NuxtPage being instantiated