This repository has been archived by the owner on Apr 6, 2023. It is now read-only.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Beta Testing
Switch to the edge channel.
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
usingexperimental: { 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 usingnuxt 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 feature 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
wherenuxt.config
,package.json
, etc is, andsrcDir
which is the same asrootDir
by default but can be customized to move project code such aspages/
to thesrc/
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 fornode_modules
via #7439 but we will keep spreading its use in other places.🧪 You can manually set
workspaceDir
fromnuxt.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 exportsdefineNuxtConfig
for type support but you don't even need this anymore! Just remove import and enjoy shorter syntax!-- import { defineNuxtConfig } from 'nuxt'
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 usingnuxt init org/repo
to clone the 3rd party GitHub repository, you should usenuxi 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
history
androutes
forapp/router.options.ts
(#7129)mockFn
andmockLogger
utils (#6235)addImportsSources
utility (#7270)immediate
option foruseAsyncData
anduseFetch
(#5500)clearNuxtData
(#5227)clearNuxtData
(#7323)unjs/giget
fornuxi init
(#7361)nuxi init
(#7404)workspaceDir
option and add it tomodulesDir
(#7439)<nuxt-link>
(#4329)<NuxtPage>
(#7492)defineNuxtConfig
(#7497)nuxt generate
(#7507)🔥 Performance
createClientOnly
wrapper using weakmap (#7297)defineNuxtConfig
fromnuxt/config
(#7485)treeshakeClientOnly
flag by default (#7484)🩹 Fixes
navigateTo
to302 Found
(#7189)http-equiv
correctly (#7190)nuxt-edge
current releases (bridge) (#7193)getModuleByUrl
(#7260)https
through to vite-node (#7271)h3.promisifyHandler
(#7275)abortMiddleware
to receive a nuxt error or error options (#7335)ssr
(#7359)nuxt.config
file (#7358)FetchError
foruseFetch
errors (#7435)@vue/runtime-core
(#7448)vite-node
(#7512)💅 Refactors
📖 Documentation
useFetch
auto generated key (#7044)useHead
composable (#7072)external
option ofnavigateTo
(#7188).client
and.server
components (#7084)useAsyncData
signature (#7242)app-config
example (#7247)AppConfig
toAppConfigInput
(#7293)nuxi prepare
command (#7349)useRuntimeConfig
page (#7406)imports.d.ts
file (#7474)srcDir
example tosrc/
(#7503)🏡 Chore
📦 Build
node
to export conditions (0cc49e2a)✅ Tests
runIf
andskipIf
helpers (#7312)🤖 CI
❤️ Contributors