Vue Updates
NuxtJS v3.10.0 #nuxt3.10.0 is the next minor/feature release. π Highlights v3.10 comes quite close on the heels of v3.9, but it's packed with features and fixes. Here are a few highlights. β¨ Experimental shared asyncData when prerendering When prerenderingβ¦
It is particularly important to make sure that any unique key of your data is always resolvable to the same data. For example, if you are using
π See full documentation.
π SSR-safe accessible unique ID creation
We now ship a
">
βοΈ Extending
It's now possible for module authors to inject their own
π See full documentation.
Client-side Node.js support
We now support (experimentally) polyfilling key Node.js built-ins (#25028), just as we already do via Nitro on the server when deploying to non-Node environments.
That means that, within your client-side code, you can import directly from Node built-ins (
Or provide your own polyfill, for example, inside a Nuxt plugin.
This should make life easier for users who are working with libraries without proper browser support. However, because of the risk in increasing your bundle unnecessarily, we would strongly urge users to choose other alternatives if at all possible.
πͺ Better cookie reactivity
We now allow you to opt-in to using the CookieStore. If browser support is present, this will then be used instead of a BroadcastChannel to update
This also comes paired with a new composable,
π₯ Detecting anti-patterns
In this release, we've also shipped a range of features to detect potential bugs and performance problems.
β We now will throw an error if
β We warn (in development only) if data fetch composables are used wrongly (#25071), such as outside of a plugin or setup context.
β We warn (in development only) if you are not using but have the
π§ Granular view transitions support
It's now possible to control view transitions support on a per-page basis, using
You need to have experimental view transitions support enabled first:
And you can opt in/out granularly:
definePageMeta({ viewTransition: false }) ">
Finally, Nuxt will not apply View Transitions if the user's browser matches
ποΈ Build-time route metadata
useAsyncData
to fetch data related to a particular page, you should provide a key that uniquely matches that data. (useFetch
should do this automatically.)π See full documentation.
π SSR-safe accessible unique ID creation
We now ship a
useId
composable for generating SSR-safe unique IDs (#23368). This allows creating more accessible interfaces in your app. For example:">
<script setup>
const emailId = useId()
const passwordId = useId()
>script>
<template>
<form>
<label :for="emailId">Email>label>
<input
:id="emailId"
name="email"
type="email"
>
<label :for="passwordId">Password>label>
<input
:id="passwordId"
name="password"
type="password"
>
>form>
>template>
βοΈ Extending
app/router.options
It's now possible for module authors to inject their own
router.options
files (#24922). The new pages:routerOptions
hook allows module authors to do things like add custom scrollBehavior
or add runtime augmenting of routes.π See full documentation.
Client-side Node.js support
We now support (experimentally) polyfilling key Node.js built-ins (#25028), just as we already do via Nitro on the server when deploying to non-Node environments.
That means that, within your client-side code, you can import directly from Node built-ins (
node:
and node imports are supported). However, nothing is globally injected for you, to avoid increasing your bundle size unnecessarily. You can either import them where needed.import { Buffer } from 'node:buffer'
import process from 'node:process'
Or provide your own polyfill, for example, inside a Nuxt plugin.
// ~/plugins/node.client.ts
import { Buffer } from 'node:buffer'
import process from 'node:process'
globalThis.Buffer = Buffer
globalThis.process = process
export default defineNuxtPlugin({})
This should make life easier for users who are working with libraries without proper browser support. However, because of the risk in increasing your bundle unnecessarily, we would strongly urge users to choose other alternatives if at all possible.
πͺ Better cookie reactivity
We now allow you to opt-in to using the CookieStore. If browser support is present, this will then be used instead of a BroadcastChannel to update
useCookie
values reactively when the cookies are updated (#25198).This also comes paired with a new composable,
refreshCookie
which allows manually refreshing cookie values, such as after performing a request. See full documentation.π₯ Detecting anti-patterns
In this release, we've also shipped a range of features to detect potential bugs and performance problems.
β We now will throw an error if
setInterval
is used on server (#25259).β We warn (in development only) if data fetch composables are used wrongly (#25071), such as outside of a plugin or setup context.
β We warn (in development only) if you are not using but have the
vue-router
integration enabled (#25490). ( should not be used on its own.)π§ Granular view transitions support
It's now possible to control view transitions support on a per-page basis, using
definePageMeta
(#25264).You need to have experimental view transitions support enabled first:
export default defineNuxtConfig({
experimental: {
viewTransition: true
},
app: {
// you can disable them globally if necessary (they are enabled by default)
viewTransition: false
}
})
And you can opt in/out granularly:
definePageMeta({ viewTransition: false }) ">
// ~/pages/index.vue
<script setup lang="ts">
definePageMeta({
viewTransition: false
})
script>
Finally, Nuxt will not apply View Transitions if the user's browser matches
prefers-reduced-motion: reduce
(#22292). You can set viewTransition: 'always'
; it will then be up to you to respect the user's preference.ποΈ Build-time route metadata
v4.3.0
#router #vue_router
4.3.0 (2024-02-21)
Bug Fixes
β check document for browser instead of window (#2042) (5631732)
β decode hash when parsing urls (#2061) (6f160b9), closes #2060
β guards: run beforeRouteEnter with app context (#2117) (6a69696), closes vuejs/router#2051
β handle undefined path in router resolve (0ec4862)
β keep optional params coming from a parent record (#2031) (04b50e5)
Features
β (internal) add types for unplugin-vue-router (2d1dd2a).
source
#router #vue_router
4.3.0 (2024-02-21)
Bug Fixes
β check document for browser instead of window (#2042) (5631732)
β decode hash when parsing urls (#2061) (6f160b9), closes #2060
β guards: run beforeRouteEnter with app context (#2117) (6a69696), closes vuejs/router#2051
β handle undefined path in router resolve (0ec4862)
β keep optional params coming from a parent record (#2031) (04b50e5)
Features
β (internal) add types for unplugin-vue-router (2d1dd2a).
source
v4.3.2
#router #vue_router
4.3.2 (2024-04-18)
Bug Fixes
β Revert "fix: avoid normalizing the fullPath (#2189)" (b78aa98), closes vuejs/router#2216. This was creating other bugs when reusing a normalized location (common pattern). The original issue wasn't a problem in practice as the consistent values are the query, params, and hash.
source
#router #vue_router
4.3.2 (2024-04-18)
Bug Fixes
β Revert "fix: avoid normalizing the fullPath (#2189)" (b78aa98), closes vuejs/router#2216. This was creating other bugs when reusing a normalized location (common pattern). The original issue wasn't a problem in practice as the consistent values are the query, params, and hash.
source
v4.4.0
#router #vue_router
4.4.0 (2024-06-21)
This version introduces native support for typed routes via the RouteNamedMap. It is now possible to define a map without unplugin-vue-router and have the types inferred automatically. It is still recommended to use unplugin-vue-router to automatically generate these types. Features
β add a clearRoutes method (abe223d)
β typed routes (f92282b)
Bug Fixes
β allow arbitrary strings in RouteLocationRaw (a7a8452)
source
#router #vue_router
4.4.0 (2024-06-21)
This version introduces native support for typed routes via the RouteNamedMap. It is now possible to define a map without unplugin-vue-router and have the types inferred automatically. It is still recommended to use unplugin-vue-router to automatically generate these types. Features
β add a clearRoutes method (abe223d)
β typed routes (f92282b)
Bug Fixes
β allow arbitrary strings in RouteLocationRaw (a7a8452)
source
v4.4.5
#router #vue_router
4.4.5 (2024-09-13)
Bug Fixes
β make internal property non enumerable to avoid errors with
source
#router #vue_router
4.4.5 (2024-09-13)
Bug Fixes
β make internal property non enumerable to avoid errors with
{{route}}
(a8df616)source
v4.5.0
#router #vue_router
4.5.0 (2024-11-25)
Bug Fixes
β combining 'end' and 'strict' (#2154) (ab62098)
β custom directive doesn't work when custom=true (#2377) (0d8d997)
β router: allow duplicated navigation on back + redirect (#2133) (d992bb2)
Features
β link: add view-transition prop (#2356) (e978eb8)
β throw if parent and child routes have the same name (#2267) (8c73877)
source
#router #vue_router
4.5.0 (2024-11-25)
Bug Fixes
β combining 'end' and 'strict' (#2154) (ab62098)
β custom directive doesn't work when custom=true (#2377) (0d8d997)
β router: allow duplicated navigation on back + redirect (#2133) (d992bb2)
Features
β link: add view-transition prop (#2356) (e978eb8)
β throw if parent and child routes have the same name (#2267) (8c73877)
source