惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Recent Commits to openclaw:main
Recent Commits to openclaw:main
L
LangChain Blog
月光博客
月光博客
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
博客园 - 【当耐特】
宝玉的分享
宝玉的分享
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
Last Week in AI
Last Week in AI
人人都是产品经理
人人都是产品经理
博客园_首页
T
Tailwind CSS Blog
P
Proofpoint News Feed
雷峰网
雷峰网
D
Darknet – Hacking Tools, Hacker News & Cyber Security
IT之家
IT之家
V
Vulnerabilities – Threatpost
阮一峰的网络日志
阮一峰的网络日志
C
CERT Recently Published Vulnerability Notes
Attack and Defense Labs
Attack and Defense Labs
S
Schneier on Security
Security Archives - TechRepublic
Security Archives - TechRepublic
L
Lohrmann on Cybersecurity
V
Visual Studio Blog
云风的 BLOG
云风的 BLOG
WordPress大学
WordPress大学
The Register - Security
The Register - Security
N
Netflix TechBlog - Medium
Hugging Face - Blog
Hugging Face - Blog
Project Zero
Project Zero
博客园 - 叶小钗
F
Full Disclosure
大猫的无限游戏
大猫的无限游戏
Latest news
Latest news
S
SegmentFault 最新的问题
C
Cyber Attacks, Cyber Crime and Cyber Security
Google Online Security Blog
Google Online Security Blog
Recorded Future
Recorded Future
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Hacker News - Newest:
Hacker News - Newest: "LLM"
腾讯CDC
L
LINUX DO - 最新话题
Google DeepMind News
Google DeepMind News
P
Privacy International News Feed
I
InfoQ
F
Fortinet All Blogs
Vercel News
Vercel News
H
Hackread – Cybersecurity News, Data Breaches, AI and More
T
Threatpost
T
Tenable Blog
B
Blog RSS Feed

The Nuxt Blog

Meet Nuxi · Nuxt Blog Introducing the Nuxt Agent · Nuxt Blog Nuxt 4.4 · Nuxt Blog Nuxt 4.3 · Nuxt Blog Building an MCP Server for Nuxt · Nuxt Blog Nuxt Image v2 · Nuxt Blog Nuxt 4.2 · Nuxt Blog Nuxt UI v4 · Nuxt Blog Nuxt 4.1 · Nuxt Blog Nuxt 3.18 · Nuxt Blog Announcing Nuxt 4.0 · Nuxt Blog Building a Privacy-First Feedback Widget · Nuxt Blog Roadmap to v4 · Nuxt Blog Nuxt 3.17 · Nuxt Blog Nuxt UI v3 · Nuxt Blog Nuxt 3.16 · Nuxt Blog Nuxt 3.15 · Nuxt Blog Introducing Nuxt Icon v1 · Nuxt Blog Nuxt 3.14 · Nuxt Blog Nuxt 3.13 · Nuxt Blog Introducing Nuxt Scripts · Nuxt Blog Nuxt 2 End-of-Life (EOL) · Nuxt Blog Nuxt 3.12 · Nuxt Blog Refreshed Nuxt ESLint Integrations · Nuxt Blog Nuxt: Looking forward · Nuxt Blog Nuxt 3.11 · Nuxt Blog The Evolution of Shiki v1.0 · Nuxt Blog Nuxt 3.9 · Nuxt Blog Nuxt DevTools v1.0 · Nuxt Blog Nuxt 3.8 · Nuxt Blog A New Website · Nuxt Blog Nuxt 3.7 · Nuxt Blog Nuxt on the Edge · Nuxt Blog Nuxt 3.6 · Nuxt Blog Nuxt 3.5 · Nuxt Blog Nuxt 3.4 · Nuxt Blog Introducing Nuxt DevTools · Nuxt Blog Nuxt 3.3 · Nuxt Blog Nuxt: A vision for 2023 · Nuxt Blog Announcing 3.0 · Nuxt Blog Announcing Nuxt 3 Release Candidate · Nuxt Blog Introducing Nuxt 3 Beta · Nuxt Blog Nuxt 2 Static Improvements · Nuxt Blog Going Full Static · Nuxt Blog Understanding how fetch works in Nuxt 2.12 · Nuxt Blog Nuxt 2: From Terminal to Browser · Nuxt Blog Introducing Smart Prefetching · Nuxt Blog Navigation · Nuxt Blog
Nuxt 3.10 · Nuxt Blog
2024-01-30 · via The Nuxt Blog

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 routes, we can end up refetching the same data over and over again. In Nuxt 2 it was possible to create a 'payload' which could be fetched once and then accessed in every page (and this is of course possible to do manually in Nuxt 3 - see this article).

With #24894, we are now able to do this automatically for you when prerendering your site. Your useAsyncData and useFetch calls will be deduplicated and cached between renders of your site.

nuxt.config.ts

export defineNuxtConfig({
  experimental: {
    sharedPrerenderData: true
  }
})

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 useAsyncData to fetch data related to a particular page, you should provide a key that uniquely matches that data. (useFetch should do this automatically.)

Read more in Docs > Guide > Going Further > Experimental Features#sharedprerenderdata.

🆔 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:

components/MyForm.vue

<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.

Read more in Docs > Guide > Going Further > Custom Routing#router Options.

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.

some-file.ts

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.

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.

Read more in Docs > API > Utils > Refresh Cookie.

🏥 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 <NuxtPage /> but have the vue-router integration enabled (#25490). (<RouterView /> 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:

nuxt.config.ts

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:

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

It's now possible to access routing metadata defined in definePageMeta at build-time, allowing modules and hooks to modify and change these values (#25210).

nuxt.config.ts

export default defineNuxtConfig({
  experimental: {
    scanPageMeta: true
  }
})

Please, experiment with this and let us know how it works for you. We hope to improve performance and enable this by default in a future release so modules like @nuxtjs/i18n and others can provide a deeper integration with routing options set in definePageMeta.

📦 Bundler module resolution

With #24837, we are now opting in to the TypeScript bundler resolution which should more closely resemble the actual way that we resolve subpath imports for modules in Nuxt projects.

'Bundler' module resolution is recommended by Vue and by Vite, but unfortunately there are still many packages that do not have the correct entries in their package.json.

As part of this, we opened 85 PRs across the ecosystem to test switching the default, and identified and fixed some issues.

If you need to switch off this behaviour, you can do so. However, please consider raising an issue (feel free to tag me in it) in the library or module's repo so it can be resolved at source.

nuxt.config.ts

export default defineNuxtConfig({
  future: {
    typescriptBundlerResolution: false
  }
})

✅ Upgrading

As usual, our recommendation for upgrading is to run:

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.

Full Release Notes

Read the full release notes of Nuxt v3.10.0.

Thank you for reading this far! We hope you enjoy the new release. Please do let us know if you have any feedback or issues.

Happy Nuxting ✨