v3.13.0
NuxtJS#nuxt
π Highlights
I'm pretty excited about this release - we've ported some features we had planned for Nuxt v4 back to v3, as well as a raft of bug fixes and performance improvements - as usual.
Here are a few of things I'm most excited about.
ποΈ Route GroupsWe now support naming directories with parentheses/brackets to organise your routes without affecting the path.
For example:
-| pages/ ---| index.vue ---| (marketing)/ -----| about.vue -----| contact.vue
This will produce /, /about and /contact pages in your app. The marketing group is ignored for purposes of your URL structure.
Read more in the original PR.
ποΈ Islands and Head MetadataIt's now possible for server component islands to manipulate the head, such as by adding SEO metadata when rendering.
Read more in #27987.
πͺ Custom Prefetch TriggersWe now support custom prefetch triggers for NuxtLink (#27846).
For example:
This will prefetch when hovered or when it gains focus This will prefetch when hovered/focus - or when it becomes visible">
<template>
<div>
<NuxtLink prefetch-on="interaction">
This will prefetch when hovered or when it gains focus
>NuxtLink>
<NuxtLink :prefetch-on="{ visibility: true, interaction: true }">
This will prefetch when hovered/focus - or when it becomes visible
>NuxtLink>
>div>
>template>It's also possible to enable/disable these globally for your app and override them per link.
For example:
export default defineNuxtConfig({
experimental: {
defaults: {
nuxtLink: {
prefetch: true,
prefetchOn: { visibility: false, interaction: true }
}
}
}
})πΊοΈ Better Server Source Maps
When running with node --enable-source-maps, you may have noticed that the source maps for the Vue files in your server build pointed to the Vite build output (something like .nuxt/dist/server/_nuxt/index-O15BBwZ3.js).
Now, even after your Nitro build, your server source maps will reference your original source files (#28521).
Note that one of the easiest ways of improving your build performance is to turn off source maps if you aren't using them, which you can do easily in your nuxt.config:
export default defineNuxtConfig({
sourcemap: {
server: false,
client: true,
},
})π New Features for Module Authors
In the run-up to Nuxt v4, we're working on adding some key functionality for module authors, including a new isNuxtMajorVersion utility where required (#27579) and better inferred typing for merged module options using the new defineNuxtModule().with() method (#27520).
We no longer warn when using data fetching composables in middleware (#28604) and we warn when user components' names begin with Lazy (#27838).
π¨ Vue TypeScript ChangesFor a while, in the Vue ecosystem, we've been augmenting @vue/runtime-core to add custom properties and more to vue. However, this inadvertently breaks the types for projects that augment vue - which is now the officially recommended in the docs way to augment these interfaces (for example, ComponentCustomProperties, GlobalComponents and so on).
This means all libraries must update their code (or it will break the types of libraries that augment vue instead).
We've updated our types in Nuxt along these lines but you may experience issues with the latest vue-router when used with libraries which haven't yet done so.
Please create an issue with a reproduction - I'll happily help create a PR to resolve in the upstream library in question. Or you may be able to work around the issue by creating a declarations.d.ts in the root of your project with the following code (credit):
import type {
ComponentCustomOptions as _ComponentCustomOptions,
ComponentCustomProperties as _ComponentCustomProperties,
} from 'vue';
declare module '@vue/runtime-core' {
interface ComponentCustomProperties extends _ComponentCustomProperties {}
interface ComponentCustomOptions extends _ComponentCustomOptions {}
}β Upgrading
As usual, our recommendation for upgrading is to run:
npx nuxi@latest upgrade --force
This will refresh your lockfile as well, and ensures that you pull in updates from other dependencies that Nuxt relies on, particularly in the unjs ecosystem.
π Changelog
π Enhancements- nuxt: Await custom
routesfunction inrouter.options(#27644) - kit: Add new
isNuxtMajorVersioncompatibility util (#27579) - kit,schema: Add
.withfor better module options types (#27520) - nuxt: Warn when user components' names begin with
Lazy(#27838) - nuxt: Allow specifying app id when creating a nuxt app (#28392)
- nuxt: Custom enable/disable hooks for
usePreviewMode(#28371) - kit: Add
prependoption toaddRouteMiddleware(#28496) - nuxt: Allow organising pages within route groups (#28276)
- vite: Preserve vite sourcemaps for nitro build (#28521)
- nuxt: Allow defining triggers for prefetching links (#27846)
- nuxt: Namespace
__NUXT__when using multi-app (#27263) - nuxt: Allow server islands to manipulate head (#27987)
π₯ Performance
- nuxt: Call cookie
decodefunction only for named cookie (#28215) - nuxt: Avoid making client-only component setup async (#28334)
- nuxt: Avoid multiple calls to
getCachedData(#28472)
π©Ή Fixes
- nuxt: Don't warn for
definePageMetain client-only pages (#28246) - kit: Include module
dist/runtime/in tsconfig includes (#28237) - schema: Support absolute/relative paths for
assetsDir(59f0099f4) - schema: Do not override user
serverDir(#28249) - schema: Use new options syntax for
vite-plugin-vue(#28307) - schema: Export new module return types (c0ad8db93)
- kit: Add missing type import (1a60b4541)
- vite,webpack: Handle local postcss plugins (#28481)
- nuxt: Handle
scroll-padding-top: autoin scrollBehavior (#28320) - nuxt: Ensure
runtimeConfig.publicis reactive on client (#28443) - nuxt: Update renamed stub composables from
nuxt/scripts(#28449) - nuxt: Augment
@vue/runtime-coreand@vue/runtime-dom(#28446) - nuxt: Scan jsx pages for page metadata (#28479)
- nuxt: Handle plugin type extensions more correctly (#28480)
- vite: Respect
baseURLfor public assets in dev (#28482) - vite: Add transformation result to log for parse errors (#28508)
- vite: Include module symbols in generated code (#28509)
- nuxt: Add reason when aborting request in
useFetch(#28517) - nuxt: Only augment
vue, not sub-packages (#28542) - nuxt: Avoid stripping js extensions in plugin injections (#28593)
- nuxt: Preserve route-specific metadata on
route.meta(#28441) - nuxt: Don't warn when data fetching in middleware (#28604)
- nuxt: Extract route rules/page meta in 2+ script blocks (#28625)
- nuxt: Allow customising status code in
validatemethod (#28612) - nuxt: Do not provide default
prefetchOnprop (#28630) - nuxt: Revert back to object syntax for island head (#28656)
π Documentation
- Fix issue in cookie passing example (#28223)
- Fix note in layers usage chapter ([#28236](https://github.com/nuxt/...

Generated by RSStT. The copyright belongs to the original author.