MyGit

v3.0.0-rc.10

nuxt/nuxt

版本发布时间: 2023-01-20 05:20:00

nuxt/nuxt最新发布版本:v3.11.2(2024-04-05 00:06:42)

Originally published at https://github.com/nuxt/framework/releases/tag/v3.0.0-rc.10

💬 Join the release discussion

🚀 How to Upgrade

Note Make sure to recreate the lock file in the project in case of any issues after the upgrade.

⭐ What is new?

Critical Styles are Inlined

#6755, #7160

Global styles and used component styles are now automatically inlined when server-side rendering a page. This feature helps to improve the First Contentful Paint (FCP) metric.

🧪 You can disable the feature from nuxt.config using experimental: { inlineSSRStyles: false } in case of any issues.

Full Static Generation with Payload Rendering

#6411, #6455

In Nuxt 2, we introduced an amazing feature called Full Static Generation. When using nuxt generate, the payload of each page containing asyncData and state is extracted to a .js chunk and we can deploy output to any static hosting without requiring a hosted API server. This feature also introduced performance benefits to reduce page size and allow smartly prefetching payload of next pages ahead of time when using nuxt generate but kept limited to it.

This feature is now back in Nuxt 3 but much better! Payload is not only extracted during prerendering phase (nuxt generate) but also can be rendered on demand by simply appending /_payload.js to the end of any URL. This made implementation much simpler and also unlocks future development to enable payload rendering for hybrid static server and incremental generated pages. Followup #6411 for the roadmap.

Link Prefetching

#4329

Another goodie ported from Nuxt 2, is automatically prefetching the next pages when a <NuxtLink> is in the viewport.

This feature is integrated with vue-router to prefetch components of the next route and also payload extraction to prefetch the payload of the next pages ahead of time! You can also hook into link:prefetch to do more prefetches.

Better Workspace Support

unjs/pkg-types#34, #7439

Nuxt has several configurations for directories including rootDir where nuxt.config, package.json, etc is, and srcDir which is the same as rootDir by default but can be customized to move project code such as pages/ to the src/ directory. With Monorepo becoming more popular, it became clear we need another new option to act smarter in a monorepo.

We have introduced a new workspaceDir configuration. It is automatically detected from rootDir using different heuristics (how?). This option is used to extend the search path for node_modules via #7439 but we will keep spreading its use in other places.

🧪 You can manually set workspaceDir from nuxt.config in case of any issues.

defineNuxtConfig is Auto Imported

#7267, #7485, #7497

Nuxt uses unjs/jiti in order to support typescript and ESM syntax for nuxt.config. When importing { defineNuxtConfig } from 'nuxt' in Nuxt 3, it causes the whole nuxt package to be loaded. It was making startup time slower.

We have introduced a new nuxt/config subpath export that only exports defineNuxtConfig for type support but you don't even need this anymore! Just remove import and enjoy shorter syntax!

-- import { defineNuxtConfig } from 'nuxt'
export default defineNuxtConfig({
})

More Powerful nuxt init

We have switched to unjs/giget for a much more powerful template init engine.

Normally nuxi init command should work as it was before. If you were using nuxt init org/repo to clone the 3rd party GitHub repository, you should use nuxi init gh:org/repo now.

Experimental Zero-Client-JS Mode

#7156, #7248

This new experimental flag allows turning off all Nuxt client js code when server-side rendering a page.

Using this feature is advisable for the very small minority of sites that would not benefit from client-side JS.

You can try this feature by setting experimental: { noScripts: true } and let us know what you think!


Changelog

(see all commits)

🚀 Enhancements

🔥 Performance

🩹 Fixes

💅 Refactors

📖 Documentation

🏡 Chore

📦 Build

✅ Tests

🤖 CI

❤️ Contributors

相关地址:原始地址 下载(tar) 下载(zip)

查看:2023-01-20发行的版本